Build for PR 118 #131
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 Pull Request' | |
run-name: Build for PR ${{ github.event.pull_request.number }} | |
on: | |
pull_request: | |
types: | |
- synchronize | |
- opened | |
- ready_for_review | |
- reopened | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
tests-to-run: ${{ steps.test.outputs.tests-to-run }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1000 | |
fetch-tags: true | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'microsoft' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
# Runs the collect-tests shell script and sets the output variable | |
- name: Determine tests to run | |
id: test | |
run: | | |
#!/bin/bash | |
./.github/scripts/collect-tests.sh | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1000 | |
fetch-tags: true | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'microsoft' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Build | |
run: ./gradlew --info -s -x assemble | |
- name: Publish artifacts | |
uses: neoforged/action-pr-publishing/upload@v1 | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: setup | |
strategy: | |
fail-fast: false | |
matrix: | |
test: ${{ fromJSON(needs.setup.outputs.tests-to-run) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1000 | |
fetch-tags: true | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'microsoft' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Test | |
run: ./gradlew --info -s ${{ matrix.test }} | |
# Always upload test results | |
- name: Merge Test Reports | |
if: success() || failure() | |
run: npx junit-report-merger junit.xml "**/TEST-*.xml" | |
- uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
if-no-files-found: ignore | |
name: test-results-${{ matrix.test }} | |
path: junit.xml | |
retention-days: 1 | |
process-test-data: | |
runs-on: ubuntu-latest | |
needs: test | |
if: success() || failure() | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download reports' artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: test-results-* | |
path: downloaded_artifacts | |
- name: Merge Test Reports | |
if: success() || failure() | |
run: npx junit-report-merger junit.xml "**/TEST-*.xml" | |
- uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: test-results | |
path: junit.xml |