chore: run tests and build artifact in parallel

This commit is contained in:
Arnaud Roques 2023-05-12 14:06:41 +02:00
parent c57f5b4691
commit b3a0c52d40
1 changed files with 6 additions and 3 deletions

View File

@ -74,7 +74,6 @@ jobs:
# We run the tests on many OS / Java combinations but also the Compile step because some users build # We run the tests on many OS / Java combinations but also the Compile step because some users build
# their own jars from source, so it is good for CI to check that is working on all combinations. # their own jars from source, so it is good for CI to check that is working on all combinations.
test: test:
if: needs.workflow_config.outputs.do_test == 'true'
needs: workflow_config needs: workflow_config
strategy: strategy:
fail-fast: false fail-fast: false
@ -84,9 +83,11 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
if: needs.workflow_config.outputs.do_test == 'true'
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up java - name: Set up java
if: needs.workflow_config.outputs.do_test == 'true'
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: ${{ matrix.java_version }} java-version: ${{ matrix.java_version }}
@ -95,14 +96,16 @@ jobs:
# Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI # Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI
- name: Compile - name: Compile
if: needs.workflow_config.outputs.do_test == 'true'
run: gradle -q compileJava --no-daemon run: gradle -q compileJava --no-daemon
- name: Test - name: Test
if: needs.workflow_config.outputs.do_test == 'true'
run: gradle test --no-daemon -i run: gradle test --no-daemon -i
- name: Upload test reports - name: Upload test reports
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: ${{ always() }} if: needs.workflow_config.outputs.do_test == 'true'
with: with:
# Using github.run_number here to reduce confusion when downloading & comparing from several builds # Using github.run_number here to reduce confusion when downloading & comparing from several builds
name: ${{ github.run_number }}-${{ matrix.os }}-java-${{ matrix.java_version }}-test-reports name: ${{ github.run_number }}-${{ matrix.os }}-java-${{ matrix.java_version }}-test-reports
@ -160,7 +163,7 @@ jobs:
if: | if: |
needs.workflow_config.outputs.do_release == 'true' || needs.workflow_config.outputs.do_release == 'true' ||
needs.workflow_config.outputs.do_snapshot_release == 'true' needs.workflow_config.outputs.do_snapshot_release == 'true'
needs: [ workflow_config, build_artifacts ] needs: [ workflow_config, build_artifacts, test ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the repository - name: Checkout the repository