2023-02-20 01:36:20 +01:00
|
|
|
name: Run unit tests against all PRs
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
java-version: '11'
|
|
|
|
distribution: 'adopt'
|
|
|
|
cache: gradle
|
|
|
|
|
2023-03-03 16:21:36 +01:00
|
|
|
- name: Get PR number
|
|
|
|
id: pr
|
|
|
|
run: echo "::set-output name=pull_request_number::$(gh pr view --json number -q .number || echo "")"
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-02-20 01:36:20 +01:00
|
|
|
- name: Validate Gradle wrapper
|
|
|
|
uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
|
|
|
- name: Run unit tests
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
with:
|
|
|
|
arguments: build
|
|
|
|
env:
|
2023-03-03 16:21:36 +01:00
|
|
|
GITHUB_VERSION: pr${{ steps.pr.outputs.pull_request_number }}
|
2023-02-20 01:36:20 +01:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-03-03 16:21:36 +01:00
|
|
|
|
|
|
|
- name: Staging artifact
|
|
|
|
run: mkdir staging && cp build/libs/*.jar staging
|
|
|
|
|
|
|
|
- name: Artifact output
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: multiverse-core-pr${{ steps.pr.outputs.pull_request_number }}
|
|
|
|
path: staging
|