Skip to content

Commit 4f00dae

Browse files
committed
chore(ci): optimize kokoro system tests with concurrency
1 parent f932bca commit 4f00dae

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.kokoro/system.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,26 @@ for path in `find 'packages' \
140140
set -e
141141

142142
if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then
143-
# Call the function - its internal exports won't affect the next loop
144-
run_package_test "$package_name" || RETVAL=$?
143+
PACKAGES_TO_TEST="${PACKAGES_TO_TEST} ${package_name}"
145144
else
146145
echo "No changes in ${package_name} and not a continuous build, skipping."
147146
fi
148147
done
148+
149+
if [ -n "$PACKAGES_TO_TEST" ]; then
150+
mkdir -p .logs
151+
export -f run_package_test
152+
export system_test_script PROJECT_ROOT KOKORO_GFILE_DIR
153+
154+
echo "$PACKAGES_TO_TEST" | xargs -n 1 -P 8 -I {} bash -c 'run_package_test "{}" > ".logs/{}.log" 2>&1 || touch ".logs/{}.failed"'
155+
156+
for failed in .logs/*.failed; do
157+
if [ -f "$failed" ]; then
158+
echo "--- FAILED: ${failed%.failed} ---"
159+
cat "${failed%.failed}.log"
160+
RETVAL=1
161+
fi
162+
done
163+
fi
164+
149165
exit ${RETVAL}

0 commit comments

Comments
 (0)