Skip to content

Commit 721b59a

Browse files
committed
CI: Merge all the steps to run only one test
Setting up a full CI run for a single test is expensive: we should make the most of it by running it a couple of times, either to check for the reproducibility of a given seed or to look for seeds that produce failures
1 parent 9bba005 commit 721b59a

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

.github/workflows/common.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
repeats:
2727
description: 'Number of test attempts'
2828
type: string
29-
default: ''
29+
default: '10'
3030
compiler_commit:
3131
description: 'Version (commit) of the OCaml compiler to use'
3232
type: string
@@ -85,19 +85,16 @@ jobs:
8585
run: opam exec -- dune runtest -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice
8686
if: inputs.only_test == ''
8787

88-
- name: Run the one test
89-
run: opam exec -- dune exec "$ONLY_TEST" -- -v
90-
if: inputs.only_test != '' && inputs.seed == '' && inputs.repeats == ''
91-
92-
- name: Run the one test with a fixed seed
93-
run: opam exec -- dune exec "$ONLY_TEST" -- -v -s "$SEED"
94-
if: inputs.only_test != '' && inputs.seed != '' && inputs.repeats == ''
95-
96-
- name: Repeat the one test with a fixed seed
88+
- name: Run only one test
9789
run: |
9890
failures=0
9991
for i in `seq "$REPEATS"`; do
100-
opam exec -- dune exec "$ONLY_TEST" -- -v -s "$SEED" || failures=$((failures + 1))
92+
if [ -n "$SEED" ]; then
93+
opam exec -- dune exec "$ONLY_TEST" -- -v -s "$SEED" || failures=$((failures + 1))
94+
else
95+
opam exec -- dune exec "$ONLY_TEST" -- -v || failures=$((failures + 1))
96+
fi
10197
done
102-
exit "$failures"
103-
if: inputs.only_test != '' && inputs.seed != '' && inputs.repeats != ''
98+
echo "Test failed $failures times"
99+
[ "$failures" = 0 ]
100+
if: inputs.only_test != ''

0 commit comments

Comments
 (0)