forked from jcm236/Starlance
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.48 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Build And Test
on:
workflow_dispatch:
push:
pull_request: # do not use pull_request_target since it probably won't up to date with PR
types:
- opened
- synchronize
concurrency:
group: build-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Check & Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Gradle Check
run: ./gradlew check
build:
if: ${{ github.event_name != 'push' }}
name: Build
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: LOG-METADATA-1
run: |
echo "output:PR_NUMBER=${{ github.event.number }}"
echo "output:HEAD_SHA=${{ github.sha }}"
- name: Gradle Build
run: ./gradlew build "-Dmod_artifact_suffix=-pr${{ github.event.pull_request.number }}-$(git rev-parse --short ${{ github.sha }})"
- name: Upload Build Artifacts
id: artifact
uses: actions/upload-artifact@v4
with:
name: ${{ format('Starlance PR {0}', github.event.number) }}
path: build/libs
overwrite: true
if-no-files-found: error
- name: LOG-METADATA-2
run: |
echo "output:ARTIFACT_URL=${{ steps.artifact.outputs.artifact-url }}"