File tree Expand file tree Collapse file tree 1 file changed +28
-9
lines changed
Expand file tree Collapse file tree 1 file changed +28
-9
lines changed Original file line number Diff line number Diff line change 3838# A file for running system tests
3939system_test_script=" ${PROJECT_ROOT} /.kokoro/system-single.sh"
4040
41+ # This is needed in order for `git diff` to succeed
42+ git config --global --add safe.directory $( realpath .)
43+
4144# Run system tests for each package with directory packages/*/tests/system
4245for dir in ` find ' packages' -type d -wholename ' packages/*/tests/system' ` ; do
4346 # Get the path to the package by removing the suffix /tests/system
4447 package=$( echo $dir | cut -f -2 -d ' /' )
45- echo " Running system tests for ${package} "
46- pushd ${package}
47- # Temporarily allow failure.
48+ should_test=false
49+
50+ files_to_check=${package} /CHANGELOG.md
51+
52+ echo " checking changes with 'git diff " ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH} ...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} " -- ${files_to_check} '"
4853 set +e
49- ${system_test_script}
50- ret=$?
54+ package_modified=$( git diff " ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH} ...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} " -- ${files_to_check} | wc -l)
5155 set -e
52- if [ ${ret} -ne 0 ]; then
53- RETVAL=${ret}
56+ if [[ " ${package_modified} " -eq 0 ]]; then
57+ echo " no change detected in ${files_to_check} , skipping"
58+ else
59+ echo " change detected in ${files_to_check} "
60+ should_test=true
5461 fi
55- popd
56- done
62+ if [ " ${should_test} " = true ] ; then
63+ echo " Running system tests for ${package} "
5764
65+ pushd ${package}
66+ # Temporarily allow failure.
67+ set +e
68+ ${system_test_script}
69+ ret=$?
70+ set -e
71+ if [ ${ret} -ne 0 ]; then
72+ RETVAL=${ret}
73+ fi
74+ popd
75+ fi
76+ done
5877exit ${RETVAL}
You can’t perform that action at this time.
0 commit comments