|
90 | 90 | max_test_time_as_int=$(printf "%.0f\n" "$max_test_time")
|
91 | 91 | echo "max test time : $max_test_time_as_int"
|
92 | 92 |
|
93 |
| - number_of_instances=$(( $sum_of_all_tests_as_int / $max_test_time_as_int )) |
| 93 | + number_of_instances=${NUMBER_OF_JOBS} |
94 | 94 | echo "number of instances $number_of_instances"
|
95 | 95 |
|
96 | 96 | average_time_per_instance=$(( sum_of_all_tests_as_int / number_of_instances ))
|
@@ -133,6 +133,15 @@ runs:
|
133 | 133 | echo "current index : ${CURRENT_INDEX}"
|
134 | 134 | tests_to_run_in_current_index=$tests_to_take_in_current_iteration
|
135 | 135 | echo "time of tests in current index : $sum"
|
| 136 | + |
| 137 | + # this can be the case when we delete some tests in some PR for example |
| 138 | + # the previous cache will contain more tests then we currently have, so some |
| 139 | + # matrix instances will have no tests to run |
| 140 | + if [[ "$sum" -eq "0" ]]; then |
| 141 | + echo "no tests to run in current index, most probably this PR removed some tests" |
| 142 | + tests_to_run_in_current_index='none' |
| 143 | + fi |
| 144 | + |
136 | 145 | fi
|
137 | 146 |
|
138 | 147 | done
|
@@ -188,13 +197,18 @@ runs:
|
188 | 197 | unset IFS
|
189 | 198 |
|
190 | 199 | for i in "${sliced_array[@]}"; do
|
191 |
| - filename="${i}.txt" |
192 |
| - echo "searching for filename: ${filename}" |
193 |
| - file=$(find . -name "${filename}") |
194 |
| - echo "found file: ${file}" |
195 |
| - result=$(cat "${file}" | grep 'elapsed' | awk '{print $12, $13}') |
196 |
| - |
197 |
| - echo "run test: ${i} in : ${result}" >> /tmp/test_times_${{ env.CURRENT_INDEX }}.txt |
| 200 | + |
| 201 | + # can be present in the last index as 'none,testA,testB' |
| 202 | + if [[ "$i" -eq "none" ]]; then |
| 203 | + echo "skipping 'none'" |
| 204 | + else |
| 205 | + filename="${i}.txt" |
| 206 | + echo "searching for filename: ${filename}" |
| 207 | + file=$(find . -name "${filename}") |
| 208 | + echo "found file: ${file}" |
| 209 | + result=$(cat "${file}" | grep 'elapsed' | awk '{print $12, $13}') |
| 210 | + echo "run test: ${i} in : ${result}" >> /tmp/test_times_${{ env.CURRENT_INDEX }}.txt |
| 211 | + fi |
198 | 212 | done
|
199 | 213 | fi
|
200 | 214 |
|
|
0 commit comments