mirror of https://github.com/hashicorp/consul
fix runner count logic in set_test_package_matrix.sh from adding an additional runner (#19620)
* fix runner count logic in set_test_package_matrix.sh from adding an additional runner * use ceil instead of floorpull/18430/head^2
parent
bcf6f627b9
commit
2ff6ab19ce
|
@ -5,7 +5,13 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
export RUNNER_COUNT=$1
|
export RUNNER_COUNT=$1
|
||||||
|
|
||||||
|
if ((RUNNER_COUNT < 1 ))
|
||||||
|
then
|
||||||
|
echo ERROR: RUNNER_COUNT must be greater than zero.
|
||||||
|
exit 1 # terminate and indicate error
|
||||||
|
fi
|
||||||
|
|
||||||
# set matrix var to list of unique packages containing tests
|
# set matrix var to list of unique packages containing tests
|
||||||
matrix="$(go list -json="ImportPath,TestGoFiles" ./... | jq --compact-output '. | select(.TestGoFiles != null) | .ImportPath' | shuf | jq --slurp --compact-output '.' | jq --argjson runnercount $RUNNER_COUNT -cM '[_nwise(length / $runnercount | floor)]'))"
|
matrix="$(go list -json="ImportPath,TestGoFiles" ./... | jq --compact-output '. | select(.TestGoFiles != null) | .ImportPath' | shuf | jq --slurp --compact-output '.' | jq --argjson runnercount $RUNNER_COUNT -cM '[_nwise(length / $runnercount | ceil)]'))"
|
||||||
|
|
||||||
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
|
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|
Loading…
Reference in New Issue