Skip to content

Commit 95dc07c

Browse files
committed
conditionally run the split integration/graalvm tests if that module was touched
1 parent 519e851 commit 95dc07c

File tree

2 files changed

+65
-38
lines changed

2 files changed

+65
-38
lines changed

.kokoro/build.sh

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,32 @@ case ${JOB_TYPE} in
7878
fi
7979
;;
8080
integration-single)
81-
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
82-
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
83-
mvn verify -Penable-integration-tests \
84-
${INTEGRATION_TEST_ARGS} \
85-
-B -ntp -fae \
86-
-DtrimStackTrace=false \
87-
-Dclirr.skip=true \
88-
-Denforcer.skip=true \
89-
-Dorg.slf4j.simpleLogger.showDateTime=true \
90-
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
91-
-Dcheckstyle.skip=true \
92-
-Dflatten.skip=true \
93-
-Danimal.sniffer.skip=true \
94-
-Djacoco.skip=true \
95-
-DskipUnitTests=true \
96-
-Dmaven.wagon.http.retryHandler.count=5 \
97-
-T 1C ${SUREFIRE_JVM_OPT}
81+
generate_modified_modules_list false
82+
if [[ ! " ${modified_module_list[*]} " =~ " ${BUILD_SUBDIR} " ]]; then
83+
echo "${BUILD_SUBDIR} not modified, skipping split integration test"
84+
else
85+
echo "${BUILD_SUBDIR} modified, running split integration test"
86+
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
87+
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
88+
mvn verify -Penable-integration-tests \
89+
${INTEGRATION_TEST_ARGS} \
90+
-B -ntp -fae \
91+
-DtrimStackTrace=false \
92+
-Dclirr.skip=true \
93+
-Denforcer.skip=true \
94+
-Dorg.slf4j.simpleLogger.showDateTime=true \
95+
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
96+
-Dcheckstyle.skip=true \
97+
-Dflatten.skip=true \
98+
-Danimal.sniffer.skip=true \
99+
-Djacoco.skip=true \
100+
-DskipUnitTests=true \
101+
-Dmaven.wagon.http.retryHandler.count=5 \
102+
-T 1C ${SUREFIRE_JVM_OPT}
98103

99-
RETURN_CODE=$?
100-
printf "Finished integration tests for modules:\n%s\n" "${BUILD_SUBDIR}"
104+
RETURN_CODE=$?
105+
printf "Finished integration tests for modules:\n%s\n" "${BUILD_SUBDIR}"
106+
fi
101107
;;
102108
graalvm-presubmit)
103109
generate_graalvm_presubmit_modules_list
@@ -124,21 +130,27 @@ case ${JOB_TYPE} in
124130
fi
125131
;;
126132
graalvm-single)
127-
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
128-
mvn test -Pnative \
129-
${INTEGRATION_TEST_ARGS} \
130-
-B -ntp -fae \
131-
-DtrimStackTrace=false \
132-
-Dclirr.skip=true \
133-
-Denforcer.skip=true \
134-
-Dorg.slf4j.simpleLogger.showDateTime=true \
135-
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
136-
-Dcheckstyle.skip=true \
137-
-Dflatten.skip=true \
138-
-Danimal.sniffer.skip=true
133+
generate_modified_modules_list false
134+
if [[ ! " ${modified_module_list[*]} " =~ " ${BUILD_SUBDIR} " ]]; then
135+
echo "${BUILD_SUBDIR} not modified, skipping split GraalVM test"
136+
else
137+
echo "${BUILD_SUBDIR} modified, running split GraalVM test"
138+
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
139+
mvn test -Pnative \
140+
${INTEGRATION_TEST_ARGS} \
141+
-B -ntp -fae \
142+
-DtrimStackTrace=false \
143+
-Dclirr.skip=true \
144+
-Denforcer.skip=true \
145+
-Dorg.slf4j.simpleLogger.showDateTime=true \
146+
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
147+
-Dcheckstyle.skip=true \
148+
-Dflatten.skip=true \
149+
-Danimal.sniffer.skip=true
139150

140-
RETURN_CODE=$?
141-
printf "Finished GraalVM ITs for modules:\n%s\n" "${BUILD_SUBDIR}"
151+
RETURN_CODE=$?
152+
printf "Finished GraalVM ITs for modules:\n%s\n" "${BUILD_SUBDIR}"
153+
fi
142154
;;
143155
lint)
144156
if [ -n "${BASE_SHA}" ] && [ -n "${HEAD_SHA}" ]; then

.kokoro/common.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ function release_please_snapshot_pull_request() {
157157
fi
158158
}
159159

160+
# Sets bash variables for maven_modules and modified_module_list
161+
# maven_modules is the list of all maven submodules of the root pom
162+
# modified_module_list is the subset of maven_modules that have been touched
163+
# in the current pull request
164+
#
165+
# The first positional argument is a value true/false. If true (default), then
166+
# exclude modules from the global exclusion list.
160167
function generate_modified_modules_list() {
161168
# Find the files changed from when the PR branched to the last commit
162169
# Filter for java modules and get all the unique elements
@@ -169,11 +176,19 @@ function generate_modified_modules_list() {
169176
# Generate the list of valid maven modules
170177
maven_modules_list=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*</.*>' | sed -e 's/<.*>\(.*\)<\/.*>/\1/g')
171178
maven_modules=()
172-
for module in $maven_modules_list; do
173-
if [[ ! " ${excluded_modules[*]} " =~ " ${module} " ]]; then
174-
maven_modules+=("${module}")
175-
fi
176-
done
179+
180+
# If the first argument is "true" (default), then use the module exclusion list
181+
use_exclusion_list=${1:-true}
182+
if [[ "${use_exclusion_list}" == "true" ]]; then
183+
echo "Excluding modules from the global exclusion list"
184+
for module in $maven_modules_list; do
185+
if [[ ! " ${excluded_modules[*]} " =~ " ${module} " ]]; then
186+
maven_modules+=("${module}")
187+
fi
188+
done
189+
else
190+
maven_modules=(${maven_modules_list[*]})
191+
fi
177192

178193
modified_module_list=()
179194
# If either parent pom.xml is touched, run ITs on all the modules

0 commit comments

Comments
 (0)