mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
157 lines
4.4 KiB
YAML
157 lines
4.4 KiB
YAML
name: Run Tests
|
|
on: [push, pull_request]
|
|
|
|
concurrency:
|
|
group: build-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
version: [7.5.0-jdk17]
|
|
runs-on: ubuntu-22.04
|
|
container:
|
|
image: gradle:${{ matrix.version }}
|
|
options: --user root
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: gradle/wrapper-validation-action@v1
|
|
- run: gradle build check -x test --stacktrace --warning-mode fail
|
|
|
|
# This job is used to feed the test matrix of next job to allow the tests to run in parallel
|
|
prepare_test_matrix:
|
|
# Lets wait to ensure it builds before going running tests
|
|
needs: build
|
|
|
|
runs-on: ubuntu-22.04
|
|
container:
|
|
image: gradle:7.5.0-jdk17
|
|
options: --user root
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: gradle writeActionsTestMatrix --stacktrace --warning-mode fail
|
|
-
|
|
id: set-matrix
|
|
run: echo "::set-output name=matrix::$(cat build/test_matrix.json)"
|
|
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
|
|
run_tests:
|
|
needs: prepare_test_matrix
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
version: [7.4.0-jdk17]
|
|
test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}
|
|
|
|
runs-on: ubuntu-22.04
|
|
container:
|
|
image: gradle:${{ matrix.version }}
|
|
options: --user root
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: gradle printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
|
|
env:
|
|
TEST_WARNING_MODE: fail
|
|
id: test
|
|
- name: Publish test results for report
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ failure() || success() }}
|
|
with:
|
|
name: Raw Test Results
|
|
path: build/test-results/**/*.xml
|
|
retention-days: 1
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: ${{ steps.test.outputs.test }} Results
|
|
path: build/reports/
|
|
|
|
run_tests_windows:
|
|
needs: prepare_test_matrix
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
java: [17]
|
|
test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}
|
|
|
|
runs-on: windows-2022
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: setup jdk ${{ matrix.java }}
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: ${{ matrix.java }}
|
|
- run: ./gradlew printActionsTestName --name="${{ matrix.test }}" test --tests ${{ matrix.test }} --stacktrace --warning-mode fail
|
|
env:
|
|
TEST_WARNING_MODE: fail
|
|
id: test
|
|
- name: Publish test results for report
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ failure() || success() }}
|
|
with:
|
|
name: Raw Test Results
|
|
path: build/test-results/**/*.xml
|
|
retention-days: 1
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: ${{ steps.test.outputs.test }} (${{ matrix.java }}) Results (Windows)
|
|
path: build/reports/
|
|
|
|
# Special case this test to run across all os's
|
|
reproducible_build_test:
|
|
needs: build
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
java: [ 17, 18 ]
|
|
os: [ windows-2022, ubuntu-22.04, macos-11 ]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: ${{ matrix.java }}
|
|
|
|
- run: ./gradlew test --tests *ReproducibleBuildTest --stacktrace --warning-mode fail
|
|
- name: Publish test results for report
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ failure() || success() }}
|
|
with:
|
|
name: Raw Test Results
|
|
path: build/test-results/**/*.xml
|
|
retention-days: 1
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: Reproducible Build ${{ matrix.os }} (${{ matrix.java }}) Results
|
|
path: build/reports/
|
|
|
|
test_report:
|
|
runs-on: ubuntu-latest
|
|
needs: [run_tests, run_tests_windows, reproducible_build_test]
|
|
if: ${{ failure() || success() }}
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
path: artifacts
|
|
- name: Publish test report
|
|
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
with:
|
|
junit_files: "artifacts/**/*.xml"
|