Skip to content

Commit 32426e1

Browse files
committed
Add integration test
1 parent 0b56c87 commit 32426e1

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Integration tests
2+
on:
3+
pull_request:
4+
branches:
5+
- "**"
6+
workflow_dispatch:
7+
concurrency:
8+
group: integration-test-${{ github.ref }}
9+
cancel-in-progress: true
10+
env:
11+
split-total: 3
12+
jobs:
13+
generate-split-index-json:
14+
name: Generate split indexes
15+
runs-on: ubuntu-latest
16+
outputs:
17+
json: ${{ steps.generate.outputs.split-index-json }}
18+
steps:
19+
- name: Generate split index list
20+
id: generate
21+
uses: donnerbart/split-tests-java-action/generate-split-index-json@11efbe6f3e414504547447682e5b7eef6ac3e860 # v1
22+
with:
23+
split-total: ${{ env.split-total }}
24+
25+
integration-test:
26+
name: "Test #${{ matrix.split-index }}"
27+
runs-on: ubuntu-latest
28+
needs:
29+
- generate-split-index-json
30+
permissions:
31+
contents: read
32+
checks: write
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
split-index: ${{ fromjson(needs.generate-split-index-json.outputs.json) }}
37+
steps:
38+
- name: Checkout split-test-java
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
40+
41+
- name: Set up JDK 21
42+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4
43+
with:
44+
distribution: temurin
45+
java-version: 21
46+
47+
- name: Split tests
48+
id: split-tests
49+
uses: donnerbart/split-tests-java-action@11efbe6f3e414504547447682e5b7eef6ac3e860 # v1
50+
with:
51+
split-index: ${{ matrix.split-index }}
52+
split-total: ${{ env.split-total }}
53+
glob: '**/src/test/resources/tests/*Test.java'
54+
junit-glob: '**/src/test/resources/reports/*.xml'
55+
format: 'list'
56+
new-test-time: 'average'
57+
calculate-optimal-total-split: true
58+
debug: true
59+
60+
- name: Assert tests
61+
run: |
62+
case ${{ matrix.split-index }} in
63+
0)
64+
TESTSUITE="foobar0"
65+
;;
66+
1)
67+
TESTSUITE="foobar1"
68+
;;
69+
2)
70+
TESTSUITE="foobar2"
71+
;;
72+
*)
73+
echo "Unexpected split index"
74+
exit 1
75+
;;
76+
esac
77+
if [ "${{ steps.split-tests.outputs.test-suite }}" -ne "$TESTSUITE" ]; then
78+
echo "Expected: $TESTSUITE"
79+
echo "Actual: ${{ steps.split-tests.outputs.test-suite }}"
80+
exit 1
81+
fi

0 commit comments

Comments
 (0)