Skip to content

Commit 5801b90

Browse files
committed
chore: parallelize github actions integration testing
The integration tests are our slowest step at >25minutes. We can speed this up by running a matrix of groups of tests. We chunk files named *IT.java into groups of 5 and then give each run its own job. This makes the bottleneck the slowest test, the RecordEncryptionIT which takes something like 6-7 minutes. Signed-off-by: Robert Young <[email protected]>
1 parent f09297d commit 5801b90

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

.github/workflows/integration-tests.yaml

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,31 @@ concurrency:
2525
cancel-in-progress: true
2626

2727
jobs:
28-
integration_test_proxy:
28+
discover_integration_test_chunks:
2929
runs-on: ubuntu-latest
30-
30+
outputs:
31+
test_chunks: ${{ steps.discover.outputs.test_chunks }}
3132
steps:
33+
- name: 'Check out repository'
34+
uses: actions/checkout@v6
35+
with:
36+
fetch-depth: 0
37+
- name: 'Discover ITs'
38+
working-directory: kroxylicious-integration-tests
39+
id: discover
40+
run: |
41+
TESTS_PER_CHUNK=5
42+
TEST_CHUNKS="[$(find . -type f -name "*IT.java" -exec basename {} .java \; | xargs -L ${TESTS_PER_CHUNK} | tr ' ' , | sed 's/.*/"&"/' | sed -z 's/\n/,/g;s/,$/\n/')]"
43+
echo "test_chunks=$TEST_CHUNKS" >> $GITHUB_OUTPUT
44+
run_integration_tests:
45+
needs: discover_integration_test_chunks
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix:
49+
tests: ${{ fromJson(needs.discover_integration_test_chunks.outputs.test_chunks) }}
50+
steps:
51+
- name: Log tests to run
52+
run: echo "Running tests on classes '${{ matrix.tests }}'"
3253
- name: 'Check out repository'
3354
uses: actions/checkout@v6
3455
with:
@@ -58,7 +79,37 @@ jobs:
5879
KROXYLICIOUS_KMS_FORTANIX_ADMIN_API_KEY: ${{ secrets.KROXYLICIOUS_KMS_FORTANIX_ADMIN_API_KEY }}
5980
KROXYLICIOUS_KMS_FORTANIX_API_KEY: ${{ secrets.KROXYLICIOUS_KMS_FORTANIX_API_KEY }}
6081
working-directory: kroxylicious-integration-tests
61-
run: mvn -B verify -DskipUTs
82+
run: mvn -B verify -DskipUTs -Dit.test="${{ matrix.tests }}"
83+
integration_test_proxy:
84+
runs-on: ubuntu-latest
85+
needs: run_integration_tests
86+
if: always()
87+
steps:
88+
- name: 'Check all matrix builds'
89+
run: ${{!contains(needs.*.result, 'failure')}}
90+
integration_test_filter_archetype:
91+
runs-on: ubuntu-latest
92+
steps:
93+
- name: 'Check out repository'
94+
uses: actions/checkout@v6
95+
with:
96+
fetch-depth: 0
97+
- name: 'Set up Java'
98+
uses: actions/setup-java@v5
99+
with:
100+
java-version: 21
101+
distribution: 'temurin'
102+
- name: 'Cache Maven packages'
103+
uses: actions/cache@v4
104+
with:
105+
path: ~/.m2
106+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
107+
restore-keys: ${{ runner.os }}-m2
108+
- name: 'Build Kroxylicious archetype'
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
run: |
112+
mvn -B install -DskipTests -Dmaven.javadoc.skip=true -DskipDocs=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Djapicmp.skip=true -pl :kroxylicious-bom,:kroxylicious-filter-archetype -am
62113
- name: 'run filter archetype integration tests'
63114
working-directory: kroxylicious-filter-archetype
64115
run: mvn -B verify

0 commit comments

Comments
 (0)