Skip to content

Commit f83f654

Browse files
WangzJiRainYuYzrlw
authored
Add multi-JDK testing support to PR workflow (#15542)
* Set unit java testing matrix to 8,11,17,21 * Update integration and samples java testing matrix from 8,17 to 8,21 --------- Co-authored-by: Rain Yu <137587347+RainYuY@users.noreply.github.com> Co-authored-by: zrlw <zrlw@sina.com>
1 parent 55a3a4b commit f83f654

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

.github/workflows/build-and-test-pr.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,12 @@ jobs:
207207
208208
unit-test:
209209
needs: [check-format, unit-test-prepare]
210-
name: "Unit Test On ubuntu-latest"
210+
name: "Unit Test On ubuntu-latest Java: ${{ matrix.java }}"
211211
runs-on: ubuntu-latest
212212
strategy:
213213
fail-fast: false
214+
matrix:
215+
java: [ 8, 11, 17, 21 ]
214216
env:
215217
DISABLE_FILE_SYSTEM_TEST: true
216218
CURRENT_ROLE: ${{ matrix.case-role }}
@@ -220,11 +222,11 @@ jobs:
220222
uses: actions/checkout@v4
221223
with:
222224
fetch-depth: 0
223-
- name: "Set up JDK 21"
225+
- name: "Set up JDK ${{ matrix.java }}"
224226
uses: actions/setup-java@v4
225227
with:
226228
distribution: 'zulu'
227-
java-version: 21
229+
java-version: ${{ matrix.java }}
228230
- name: "Set current date as env variable"
229231
run: echo "TODAY=$(date +'%Y%m%d')" >> $GITHUB_ENV
230232
- name: "Cache local maven repository"
@@ -243,8 +245,15 @@ jobs:
243245
key: zookeeper-${{ runner.os }}-${{ env.ZOOKEEPER_VERSION }}
244246
restore-keys: |
245247
zookeeper-${{ runner.os }}-
246-
- name: "Test with maven"
248+
- name: "Test with maven on Java: 8"
249+
timeout-minutes: 90
250+
if: ${{ matrix.java == '8' }}
251+
run: |
252+
set -o pipefail
253+
./mvnw ${{ env.MAVEN_ARGS }} clean test verify -Pjacoco,'!jdk15ge-add-open',skip-spotless -DtrimStackTrace=false -Dmaven.test.skip=false -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false -DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper 2>&1 | tee >(grep -n -B 1 -A 200 "FAILURE! -- in" > test_errors.log)
254+
- name: "Test with maven on Java: ${{ matrix.java }}"
247255
timeout-minutes: 90
256+
if: ${{ matrix.java != '8' }}
248257
run: |
249258
set -o pipefail
250259
./mvnw ${{ env.MAVEN_ARGS }} clean test verify -Pjacoco,jdk15ge-simple,'!jdk15ge-add-open',skip-spotless -DtrimStackTrace=false -Dmaven.test.skip=false -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false -DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper 2>&1 | tee >(grep -n -B 1 -A 200 "FAILURE! -- in" > test_errors.log)
@@ -256,13 +265,13 @@ jobs:
256265
with:
257266
token: ${{ secrets.CODECOV_TOKEN }}
258267
verbose: true
259-
flags: unit-tests
268+
flags: unit-tests-java${{ matrix.java }}
260269
env:
261270
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
262271
- name: "Upload surefire reports"
263272
uses: actions/upload-artifact@v4
264273
with:
265-
name: surefire-reports
274+
name: surefire-reports-java${{ matrix.java }}
266275
path: "**/target/surefire-reports/**"
267276

268277
samples-test-prepare:
@@ -293,7 +302,7 @@ jobs:
293302
strategy:
294303
fail-fast: false
295304
matrix:
296-
java: [ 8, 17 ]
305+
java: [ 8, 21 ]
297306
job_id: [1,2,3]
298307
steps:
299308
- uses: actions/checkout@v4
@@ -365,7 +374,7 @@ jobs:
365374
JAVA_VER: ${{matrix.java}}
366375
strategy:
367376
matrix:
368-
java: [ 8, 17 ]
377+
java: [ 8, 21 ]
369378
steps:
370379
- uses: actions/checkout@v4
371380
with:
@@ -408,7 +417,7 @@ jobs:
408417
strategy:
409418
fail-fast: false
410419
matrix:
411-
java: [ 8, 17 ]
420+
java: [ 8, 21 ]
412421
job_id: [1,2,3]
413422
steps:
414423
- uses: actions/checkout@v4
@@ -480,7 +489,7 @@ jobs:
480489
JAVA_VER: ${{matrix.java}}
481490
strategy:
482491
matrix:
483-
java: [ 8, 17 ]
492+
java: [ 8, 21 ]
484493
steps:
485494
- uses: actions/checkout@v4
486495
with:
@@ -501,7 +510,7 @@ jobs:
501510
needs: [check-format, samples-test-result]
502511
strategy:
503512
matrix:
504-
java: [ 8, 17 ]
513+
java: [ 8, 21 ]
505514
steps:
506515
- uses: actions/checkout@v4
507516
- uses: actions/checkout@v4
@@ -551,7 +560,7 @@ jobs:
551560
needs: [check-format, integration-test-result, samples-test-result]
552561
strategy:
553562
matrix:
554-
java: [ 8, 17 ]
563+
java: [ 8, 21 ]
555564
steps:
556565
- uses: actions/checkout@v4
557566
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)