Skip to content

Commit 48ff8a1

Browse files
committed
CI: Add the possibility to run only one test also on Windows
1 parent 4feeef6 commit 48ff8a1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/windows.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,28 @@ on:
77
description: 'Branch or tag of ocaml/ocaml to use as compiler'
88
type: string
99
default: '5.0.0-beta1'
10+
only_test:
11+
description: 'Only test to run (eg “src/array/lin_tests.exe”); whole suite is run if empty'
12+
type: string
13+
default: ''
14+
seed:
15+
description: 'Seed for the only test'
16+
type: string
17+
default: ''
18+
repeats:
19+
description: 'Number of test attempts'
20+
type: string
21+
default: '2'
1022

1123
jobs:
1224
build:
1325
runs-on: windows-latest
1426

1527
env:
1628
COMPILER: ${{ inputs.compiler }}
29+
ONLY_TEST: ${{ inputs.only_test }}
30+
SEED: ${{ inputs.seed }}
31+
REPEATS: ${{ inputs.repeats }}
1732
QCHECK_MSG_INTERVAL: '60'
1833

1934
steps:
@@ -55,6 +70,24 @@ jobs:
5570
5671
- name: Build the test suite
5772
run: opam exec --switch=ci -- dune build
73+
if: inputs.only_test == ''
5874

5975
- name: Run the test suite
6076
run: opam exec --switch=ci -- dune runtest -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice
77+
if: inputs.only_test == ''
78+
79+
- name: Run only one test
80+
run: |
81+
$ErrorActionPreference = 'Continue'
82+
$failures = 0
83+
for($i = 1; $i -le "${env:REPEATS}"; $i++) {
84+
if("${env:SEED}" -eq "") {
85+
opam exec --switch=ci -- dune exec "${env:ONLY_TEST}" -- -v
86+
if($? -eq 0) { $failures += 1 }
87+
} else {
88+
opam exec --switch=ci -- dune exec "${env:ONLY_TEST}" -- -v -s "${env:SEED}"
89+
if($? -eq 0) { $failures += 1 }
90+
}
91+
}
92+
echo "Test failed $failures times"
93+
if: inputs.only_test != ''

0 commit comments

Comments
 (0)