Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wind57 committed Jul 18, 2023
2 parents 1c84e33 + 963096c commit 1319fe7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ runs:
max_test_time_as_int=$(printf "%.0f\n" "$max_test_time")
echo "max test time : $max_test_time_as_int"

number_of_instances=$(( $sum_of_all_tests_as_int / $max_test_time_as_int ))
number_of_instances=${NUMBER_OF_JOBS}
echo "number of instances $number_of_instances"

average_time_per_instance=$(( sum_of_all_tests_as_int / number_of_instances ))
Expand Down Expand Up @@ -133,6 +133,15 @@ runs:
echo "current index : ${CURRENT_INDEX}"
tests_to_run_in_current_index=$tests_to_take_in_current_iteration
echo "time of tests in current index : $sum"

# this can be the case when we delete some tests in some PR for example
# the previous cache will contain more tests then we currently have, so some
# matrix instances will have no tests to run
if [[ "$sum" -eq "0" ]]; then
echo "no tests to run in current index, most probably this PR removed some tests"
tests_to_run_in_current_index='none'
fi

fi

done
Expand Down Expand Up @@ -188,13 +197,18 @@ runs:
unset IFS

for i in "${sliced_array[@]}"; do
filename="${i}.txt"
echo "searching for filename: ${filename}"
file=$(find . -name "${filename}")
echo "found file: ${file}"
result=$(cat "${file}" | grep 'elapsed' | awk '{print $12, $13}')

echo "run test: ${i} in : ${result}" >> /tmp/test_times_${{ env.CURRENT_INDEX }}.txt

# can be present in the last index as 'none,testA,testB'
if [[ "$i" -eq "none" ]]; then
echo "skipping 'none'"
else
filename="${i}.txt"
echo "searching for filename: ${filename}"
file=$(find . -name "${filename}")
echo "found file: ${file}"
result=$(cat "${file}" | grep 'elapsed' | awk '{print $12, $13}')
echo "run test: ${i} in : ${result}" >> /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
fi
done
fi

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 30
# only run this one if there is a previous cache of test times
if: needs.build.outputs.test_times_cache_present == 'true'
timeout-minutes: 60

strategy:
fail-fast: true
Expand Down

0 comments on commit 1319fe7

Please sign in to comment.