Skip to content

Commit e797c7b

Browse files
authored
Merge pull request quarkusio#53666 from yrodiere/simpler-json-filter
Simplify GHA scripts/json for integration test filtering
2 parents aff871e + 390ee38 commit e797c7b

5 files changed

Lines changed: 24 additions & 89 deletions
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
22

3-
# Purpose: Prints a filtered version of native-tests.json, with "test-modules" reduced to the ones passed in as the first argument.
4-
# This first argument is expected to the define one module per line.
3+
# Purpose: Prints a filtered version of a JSON file derived from the first argument,
4+
# e.g. "native" => "native-tests.json" or "virtual-threads" => "virtual-threads-tests.json",
5+
# with "test-modules" reduced to the ones passed in as the second argument.
6+
# This second argument is expected to the define one module per line.
57
# "include" elements that (after filtering) have no "test-modules" anymore are deleted entirely!
68
# Note: This script is only for CI and does therefore not aim to be compatible with BSD/macOS.
79

@@ -11,13 +13,15 @@ shopt -s failglob
1113
# path of this shell script
1214
PRG_PATH=$( cd "$(dirname "$0")" ; pwd -P )
1315

14-
JSON=$(cat ${PRG_PATH}/native-tests.json)
16+
FILE_BASE_NAME=$1
17+
shift
18+
JSON=$(cat ${PRG_PATH}/${FILE_BASE_NAME}-tests.json)
1519

16-
JSON=$( echo "$JSON" | jq '
20+
JSON=$( echo "$JSON" | jq "$(cat <<EOF
1721
.include |= map(
1822
. + {
1923
tag: (
20-
"native-" +
24+
"$FILE_BASE_NAME-" +
2125
(.category
2226
| ascii_downcase
2327
| gsub(" "; "-")
@@ -26,7 +30,8 @@ JSON=$( echo "$JSON" | jq '
2630
)
2731
}
2832
)
29-
')
33+
EOF
34+
)")
3035

3136
# Step 0: print unfiltered json and exit in case the parameter is '_all_' (full build) or print nothing if empty (no changes)
3237
if [ "$1" == '_all_' ]

.github/filter-virtual-threads-tests-json.sh

Lines changed: 0 additions & 70 deletions
This file was deleted.

.github/virtual-threads-tests.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
{
44
"category": "Main",
55
"timeout": 60,
6-
"test-modules": "virtual-threads-disabled, grpc-virtual-threads, mailer-virtual-threads, redis-virtual-threads, rest-client-reactive-virtual-threads, resteasy-reactive-virtual-threads, vertx-event-bus-virtual-threads, scheduler-virtual-threads, quartz-virtual-threads, metrics-virtual-threads",
6+
"test-modules": "virtual-threads/virtual-threads-disabled, virtual-threads/grpc-virtual-threads, virtual-threads/mailer-virtual-threads, virtual-threads/redis-virtual-threads, virtual-threads/rest-client-reactive-virtual-threads, virtual-threads/resteasy-reactive-virtual-threads, virtual-threads/vertx-event-bus-virtual-threads, virtual-threads/scheduler-virtual-threads, virtual-threads/quartz-virtual-threads, virtual-threads/metrics-virtual-threads",
77
"os-name": "ubuntu-latest"
88
},
99
{
1010
"category": "Messaging",
1111
"timeout": 45,
12-
"test-modules": "amqp-virtual-threads, jms-virtual-threads, kafka-virtual-threads",
12+
"test-modules": "virtual-threads/amqp-virtual-threads, virtual-threads/jms-virtual-threads, virtual-threads/kafka-virtual-threads",
1313
"os-name": "ubuntu-latest"
1414
},
1515
{
1616
"category": "Security",
1717
"timeout": 20,
18-
"test-modules": "security-webauthn-virtual-threads",
18+
"test-modules": "virtual-threads/security-webauthn-virtual-threads",
1919
"os-name": "ubuntu-latest"
2020
}
2121
]

.github/workflows/ci-actions-incremental.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ jobs:
375375
- name: Verify native-tests.json
376376
run: ./.github/verify-tests-json.sh native-tests.json integration-tests/
377377
- name: Verify virtual-threads-tests.json
378-
run: ./.github/verify-tests-json.sh virtual-threads-tests.json integration-tests/virtual-threads/
378+
run: ./.github/verify-tests-json.sh virtual-threads-tests.json integration-tests/
379379
- name: Setup Develocity Build Scan capture
380380
uses: gradle/develocity-actions/setup-maven@v2.1
381381
with:
@@ -498,7 +498,7 @@ jobs:
498498
id: calc-native-matrix
499499
run: |
500500
echo "GIB_IMPACTED_MODULES: ${GIB_IMPACTED_MODULES}"
501-
json=$(.github/filter-native-tests-json.sh "${GIB_IMPACTED_MODULES}" | tr -d '\n')
501+
json=$(.github/filter-integration-tests-json.sh native "${GIB_IMPACTED_MODULES}" | tr -d '\n')
502502
echo "${json}"
503503
echo "matrix=${json}" >> $GITHUB_OUTPUT
504504
- name: Calculate matrix from matrix-jvm-tests.json
@@ -511,13 +511,13 @@ jobs:
511511
id: calc-virtual-threads-matrix
512512
run: |
513513
echo "GIB_IMPACTED_MODULES: ${GIB_IMPACTED_MODULES}"
514-
json=$(.github/filter-virtual-threads-tests-json.sh "${GIB_IMPACTED_MODULES}" | tr -d '\n')
514+
json=$(.github/filter-integration-tests-json.sh virtual-threads "${GIB_IMPACTED_MODULES}" | tr -d '\n')
515515
echo "${json}"
516516
echo "matrix=${json}" >> $GITHUB_OUTPUT
517517
- name: Calculate run flags
518518
id: calc-run-flags
519519
run: |
520-
run_devtools=true; run_gradle=true; run_maven=true; run_kubernetes=true; run_quickstarts=true; run_tcks=true
520+
run_devtools=true; run_gradle=true; run_maven=true; run_kubernetes=true; run_quickstarts=true; run_tcks=true;
521521
if [ -z "${GIB_IMPACTED_MODULES}" ]
522522
then
523523
run_devtools=false; run_gradle=false; run_maven=false; run_kubernetes=false; run_quickstarts=false; run_tcks=false
@@ -1403,14 +1403,14 @@ jobs:
14031403
CONTAINER_BUILD: ${{startsWith(matrix.os-name, 'windows') && 'false' || 'true'}}
14041404
CAPTURE_BUILD_SCAN: true
14051405
run: |
1406-
export LANG=en_US && ./mvnw $COMMON_MAVEN_ARGS $COMMON_TEST_MAVEN_ARGS $PTS_MAVEN_ARGS -f integration-tests/virtual-threads -pl "$TEST_MODULES" $NATIVE_TEST_MAVEN_ARGS -Dextra-args=--enable-preview -Dquarkus.native.container-build=true
1406+
export LANG=en_US && ./mvnw $COMMON_MAVEN_ARGS $COMMON_TEST_MAVEN_ARGS $PTS_MAVEN_ARGS -f integration-tests -pl "$TEST_MODULES" $NATIVE_TEST_MAVEN_ARGS -Dextra-args=--enable-preview -Dquarkus.native.container-build=true
14071407
- name: Prepare build reports archive
14081408
if: always()
14091409
run: |
14101410
7z a -tzip build-reports.zip -r \
1411-
'integration-tests/virtual-threads/**/target/*-reports/TEST-*.xml' \
1412-
'integration-tests/virtual-threads/target/build-report.json' \
1413-
'integration-tests/virtual-threads/target/gradle-build-scan-url.txt' \
1411+
'integration-tests/**/target/*-reports/TEST-*.xml' \
1412+
'integration-tests/**/target/build-report.json' \
1413+
'integration-tests/**/target/gradle-build-scan-url.txt' \
14141414
LICENSE
14151415
- name: Upload build reports
14161416
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0

.github/workflows/native-it-selected-graalvm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ jobs:
204204
id: calc-native-matrix
205205
run: |
206206
echo "GIB_IMPACTED_MODULES: ${GIB_IMPACTED_MODULES}"
207-
json=$(.github/filter-native-tests-json.sh "${GIB_IMPACTED_MODULES}" | tr -d '\n')
207+
json=$(.github/filter-integration-tests-json.sh native "${GIB_IMPACTED_MODULES}" | tr -d '\n')
208208
# Remove Windows from the matrix
209209
json=$(echo $json | jq 'del(.include[] | select(."os-name" == "windows-latest"))')
210210
json=$(echo $json | tr -d '\n')
@@ -214,7 +214,7 @@ jobs:
214214
id: calc-virtual-threads-matrix
215215
run: |
216216
echo "GIB_IMPACTED_MODULES: ${GIB_IMPACTED_MODULES}"
217-
json=$(.github/filter-virtual-threads-tests-json.sh "${GIB_IMPACTED_MODULES}" | tr -d '\n')
217+
json=$(.github/filter-integration-tests-json.sh virtual-threads "${GIB_IMPACTED_MODULES}" | tr -d '\n')
218218
# Remove Windows from the matrix
219219
json=$(echo $json | jq 'del(.include[] | select(."os-name" == "windows-latest"))')
220220
json=$(echo $json | tr -d '\n')

0 commit comments

Comments
 (0)