Skip to content

Update softprops/action-gh-release digest to aec2ec5 #145

Update softprops/action-gh-release digest to aec2ec5

Update softprops/action-gh-release digest to aec2ec5 #145

name: Integration tests
on:
push:
branches: ["**"]
concurrency:
group: integration-test-${{ github.ref }}
cancel-in-progress: true
env:
split-total: 4
jobs:
generate-split-index-json:
name: Generate split indexes
runs-on: ubuntu-latest
outputs:
json: ${{ steps.generate.outputs.split-index-json }}
steps:
- name: Checkout split-tests-java-action
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
repository: donnerbart/split-tests-java-action
- name: Generate split index list
id: generate
# noinspection UndefinedAction
uses: ./generate-split-index-json
# noinspection UndefinedParamsPresent
with:
split-total: ${{ env.split-total }}
integration-test:
name: "Test #${{ matrix.split-index }}"
runs-on: ubuntu-latest
needs:
- generate-split-index-json
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
split-index: ${{ fromjson(needs.generate-split-index-json.outputs.json) }}
env:
DOWNLOAD_JAR: false
JAR_PATH: split-tests-java/build/libs/split-tests-java.jar
steps:
- name: Checkout split-tests-java
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
path: split-tests-java
- name: Checkout split-tests-java-action
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
repository: donnerbart/split-tests-java-action
path: split-tests-java-action
- name: Set up JDK 21
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
with:
distribution: temurin
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5
- name: Compile split-tests-java
working-directory: split-tests-java
run: ./gradlew shadowJar
- name: Split tests
id: split-tests
# noinspection UndefinedAction
uses: ./split-tests-java-action
# noinspection UndefinedParamsPresent
with:
split-index: ${{ matrix.split-index }}
split-total: ${{ env.split-total }}
glob: '**/split-tests-java/src/test/resources/tests/*Test.java'
exclude-glob: '**/{NoClassNameTest,UnreadableTest,UnreadableNestedTest}.java'
junit-glob: '**/split-tests-java/src/test/resources/reports/*.xml'
format: 'list'
new-test-time: 'average'
calculate-optimal-total-split: true
debug: true
- name: Assert split tests
env:
SPLIT_INDEX: ${{ matrix.split-index }}
ACTUAL: ${{ steps.split-tests.outputs.test-suite }}
run: |
case "$SPLIT_INDEX" in
"0")
EXPECTED="de.donnerbart.example.SlowestTest"
;;
"1")
EXPECTED="NoPackageTest de.donnerbart.example.NoTimingTwoTest de.donnerbart.example.SlowTest"
;;
"2")
EXPECTED="de.donnerbart.example.IgnoreImportTest de.donnerbart.example.ThirdPartyLibraryTest de.donnerbart.example.FastTest"
;;
"3")
EXPECTED="de.donnerbart.example.NoTimingOneTest de.donnerbart.example.WhitespaceClassDefinitionTest"
;;
*)
echo "Unexpected split index"
exit 1
;;
esac
echo "Expected: $EXPECTED"
echo "Actual: $ACTUAL"
if [ "$ACTUAL" != "$EXPECTED" ]; then
echo "The split tests are not matching"
exit 1
fi