chore: only test Java 8 on Windows

This commit is contained in:
Arnaud Roques 2023-05-12 17:09:21 +02:00
parent d9eecbdeeb
commit 962f6df46b
1 changed files with 52 additions and 11 deletions

View File

@ -26,7 +26,8 @@ jobs:
do_release: ${{ steps.config.outputs.do_release }}
do_snapshot_release: ${{ steps.config.outputs.do_snapshot_release }}
pom_version: ${{ steps.config.outputs.pom_version }}
do_test: ${{ steps.config.outputs.do_test }}
do_test_linux: ${{ steps.config.outputs.do_test_linux }}
do_test_windows: ${{ steps.config.outputs.do_test_windows }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
@ -69,25 +70,27 @@ jobs:
else
echo "This run will NOT make a release"
fi
echo "do_test=true" >> $GITHUB_OUTPUT
echo "do_test_linux=true" >> $GITHUB_OUTPUT
echo "do_test_windows=true" >> $GITHUB_OUTPUT
# 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.
test:
# We split windows and ubuntu because windows is so slow...
test_linux:
needs: workflow_config
strategy:
fail-fast: false
matrix:
java_version: [ 8, 17 ]
os: [ ubuntu-latest, windows-latest ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
if: needs.workflow_config.outputs.do_test == 'true'
if: needs.workflow_config.outputs.do_test_linux == 'true'
uses: actions/checkout@v3
- name: Set up java
if: needs.workflow_config.outputs.do_test == 'true'
if: needs.workflow_config.outputs.do_test_linux == 'true'
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java_version }}
@ -96,16 +99,54 @@ jobs:
# Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI
- name: Compile
if: needs.workflow_config.outputs.do_test == 'true'
if: needs.workflow_config.outputs.do_test_linux == 'true'
run: gradle -q compileJava --no-daemon
- name: Test
if: needs.workflow_config.outputs.do_test == 'true'
if: needs.workflow_config.outputs.do_test_linux == 'true'
run: gradle test --no-daemon -i
- name: Upload test reports
uses: actions/upload-artifact@v3
if: needs.workflow_config.outputs.do_test == 'true'
if: needs.workflow_config.outputs.do_test_linux == 'true'
with:
# 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
path: build/reports/tests/
test_windows:
needs: workflow_config
strategy:
fail-fast: false
matrix:
java_version: [ 8 ]
os: [ windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
if: needs.workflow_config.outputs.do_test_windows == 'true'
uses: actions/checkout@v3
- name: Set up java
if: needs.workflow_config.outputs.do_test_windows == 'true'
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java_version }}
distribution: temurin
cache: gradle
# Compile / Test / Package are separate steps so the reason for any failure is more obvious in GitHub UI
- name: Compile
if: needs.workflow_config.outputs.do_test_windows == 'true'
run: gradle -q compileJava --no-daemon
- name: Test
if: needs.workflow_config.outputs.do_test_windows == 'true'
run: gradle test --no-daemon -i
- name: Upload test reports
uses: actions/upload-artifact@v3
if: needs.workflow_config.outputs.do_test_windows == 'true'
with:
# 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
@ -166,7 +207,7 @@ jobs:
if: |
needs.workflow_config.outputs.do_release == 'true' ||
needs.workflow_config.outputs.do_snapshot_release == 'true'
needs: [ workflow_config, build_artifacts, test ]
needs: [ workflow_config, build_artifacts, test_linux ]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
@ -228,7 +269,7 @@ jobs:
gradle publish
push_to_docker_registry:
needs: [ workflow_config, upload ]
needs: [ workflow_config, upload, test_linux, test_windows ]
if: needs.workflow_config.outputs.do_release == 'true'
runs-on: ubuntu-latest
steps: