|
| 1 | +name: Windows mingw64 common workflow |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + compiler: |
| 7 | + description: 'Branch or tag of ocaml/ocaml to use as compiler' |
| 8 | + type: string |
| 9 | + 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' |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + runs-on: windows-latest |
| 26 | + |
| 27 | + env: |
| 28 | + COMPILER: ${{ inputs.compiler }} |
| 29 | + ONLY_TEST: ${{ inputs.only_test }} |
| 30 | + SEED: ${{ inputs.seed }} |
| 31 | + REPEATS: ${{ inputs.repeats }} |
| 32 | + QCHECK_MSG_INTERVAL: '60' |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout code |
| 36 | + uses: actions/checkout@v2 |
| 37 | + |
| 38 | + - name: Install opam etc. with a temporary compiler |
| 39 | + uses: ocaml/setup-ocaml@v2 |
| 40 | + with: |
| 41 | + ocaml-compiler: 4.14 |
| 42 | + opam-repositories: | |
| 43 | + default: https://github.com/fdopen/opam-repository-mingw.git#opam2 |
| 44 | + override: https://github.com/shym/custom-opam-repository.git#windows |
| 45 | + upstream: https://github.com/ocaml/opam-repository.git |
| 46 | + alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git |
| 47 | + opam-pin: false |
| 48 | + opam-depext: false |
| 49 | + |
| 50 | + - name: Build and install the OCaml ${{ inputs.compiler }} compiler in a `ci` switch |
| 51 | + run: | |
| 52 | + opam switch create ci --empty --no-switch --repositories=default,override,upstream,alpha |
| 53 | + git clone https://github.com/ocaml/ocaml -b $Env:COMPILER --depth=1 --recurse-submodules |
| 54 | + cd ocaml |
| 55 | + curl https://github.com/shym/ocaml/commit/cca99d36bc5326dbe48fd9aaa10357b7de869bbc.patch | git -c user.name=CI -c user.email="[email protected]" am |
| 56 | + opam install --switch=ci . |
| 57 | + git log |
| 58 | + cd .. |
| 59 | + rmdir -Recurse -Force ocaml |
| 60 | +
|
| 61 | + - name: Show environment |
| 62 | + run: | |
| 63 | + opam exec --switch=ci -- ocamlopt --version |
| 64 | + opam config list --switch=ci |
| 65 | +
|
| 66 | + - name: Install Multicore Tests dependencies |
| 67 | + run: | |
| 68 | + opam pin --switch=ci add "https://github.com/shym/ocamlfind.git#fix-win" |
| 69 | + opam install --switch=ci . --deps-only --with-test |
| 70 | +
|
| 71 | + - name: Build the test suite |
| 72 | + run: opam exec --switch=ci -- dune build |
| 73 | + if: inputs.only_test == '' |
| 74 | + |
| 75 | + - name: Run the test suite |
| 76 | + 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