-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (106 loc) · 3.66 KB
/
integration-test.yml
File metadata and controls
118 lines (106 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
path: split-tests-java
- name: Checkout split-tests-java-action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: donnerbart/split-tests-java-action
path: split-tests-java-action
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: temurin
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # 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