Merge pull request #20 from GuyApooye/main #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |