File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ set -eo pipefail
20
20
# Enables `**` to include files nested inside sub-folders
21
21
shopt -s globstar
22
22
23
+ DIFF_FROM=" origin/main..."
24
+
23
25
# Exit early if samples don't exist
24
26
if ! find samples -name ' requirements.txt' | grep -q . ; then
25
27
echo " No tests run. './samples/**/requirements.txt' not found"
@@ -71,6 +73,16 @@ for file in samples/**/requirements.txt; do
71
73
file=$( dirname " $file " )
72
74
cd " $file "
73
75
76
+ # If $DIFF_FROM is set, use it to check for changes in this directory.
77
+ if [[ -n " ${DIFF_FROM:- } " ]]; then
78
+ git diff --quiet " $DIFF_FROM " .
79
+ CHANGED=$?
80
+ if [[ " $CHANGED " -eq 0 ]]; then
81
+ # echo -e "\n Skipping $file: no changes in folder.\n"
82
+ continue
83
+ fi
84
+ fi
85
+
74
86
echo " ------------------------------------------------------------"
75
87
echo " - testing $file "
76
88
echo " ------------------------------------------------------------"
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ def get_staging_dirs(
137
137
".github/workflows" , # exclude gh actions as credentials are needed for tests
138
138
"README.rst" ,
139
139
".github/release-please.yml" ,
140
+ ".kokoro/test-samples-impl.sh" ,
140
141
],
141
142
)
142
143
You can’t perform that action at this time.
0 commit comments