|
| 1 | +name: Common MSVC CI workflow |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_call: |
| 9 | + inputs: |
| 10 | + bytecodeonly: |
| 11 | + type: boolean |
| 12 | + default: false |
| 13 | + dune_alias: |
| 14 | + description: 'dune alias that should be built in the main step' |
| 15 | + type: string |
| 16 | + default: 'runtest' |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + permissions: {} |
| 21 | + |
| 22 | + runs-on: windows-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Save pristine PATH |
| 26 | + id: pristine |
| 27 | + run: | |
| 28 | + echo "pristine_path=${env:Path}" >> "${env:GITHUB_OUTPUT}" |
| 29 | +
|
| 30 | + - name: Set up MSVC |
| 31 | + uses: ilammy/msvc-dev-cmd@v1 |
| 32 | + |
| 33 | + - name: Fetch OCaml |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + repository: dra27/ocaml |
| 37 | + ref: restore-msvc |
| 38 | + path: ocaml |
| 39 | + submodules: true |
| 40 | + |
| 41 | + - name: Choose a cache key |
| 42 | + id: key |
| 43 | + env: |
| 44 | + BC_KEY_PART: ${{ inputs.bytecodeonly && '-bytecode' || '' }} |
| 45 | + run: | |
| 46 | + git -C ocaml rev-parse HEAD | Tee-Object -Variable sha |
| 47 | + echo "cache_key=ocaml-msvc${env:BC_KEY_PART}-${sha}" | Tee-Object -FilePath "${env:GITHUB_OUTPUT}" |
| 48 | +
|
| 49 | + - name: Restore cache |
| 50 | + uses: actions/cache/restore@v3 |
| 51 | + id: cache |
| 52 | + env: |
| 53 | + PATH: ${{ steps.pristine.outputs.pristine_path }} |
| 54 | + with: |
| 55 | + path: | |
| 56 | + C:\cygwin-packages |
| 57 | + D:\ocaml |
| 58 | + key: ${{ steps.key.outputs.cache_key }} |
| 59 | + |
| 60 | + - name: Install Cygwin (Cygwin) |
| 61 | + uses: cygwin/cygwin-install-action@v3 |
| 62 | + with: |
| 63 | + packages: make,bash |
| 64 | + install-dir: 'D:\cygwin' |
| 65 | + |
| 66 | + - name: Build OCaml |
| 67 | + shell: bash -e {0} |
| 68 | + env: |
| 69 | + NATIVE: ${{ inputs.bytecodeonly && '--disable-native-compiler' || '' }} |
| 70 | + run: | |
| 71 | + cd ocaml # |
| 72 | + mkdir /cygdrive/d/ocaml # |
| 73 | + eval $(tools/msvs-promote-path) # |
| 74 | + ./configure --host=x86_64-pc-windows --with-flexdll --prefix=/cygdrive/d/ocaml $NATIVE # |
| 75 | + make # |
| 76 | + make install # |
| 77 | + if: "steps.cache.outputs.cache-hit != 'true'" |
| 78 | + |
| 79 | + - name: Fetch dune |
| 80 | + uses: actions/checkout@v4 |
| 81 | + with: |
| 82 | + repository: ocaml/dune |
| 83 | + path: dune |
| 84 | + if: "steps.cache.outputs.cache-hit != 'true'" |
| 85 | + |
| 86 | + - name: Compile dune |
| 87 | + shell: bash -e {0} |
| 88 | + run: | |
| 89 | + export PATH="/cygdrive/d/ocaml/bin:$PATH" # |
| 90 | + eval $(ocaml/tools/msvs-promote-path) # |
| 91 | + export INCLUDE="$INCLUDE;$(cygpath -w "$PWD/ocaml/runtime/winpthreads/include")" # |
| 92 | + cd dune # |
| 93 | + make release # |
| 94 | + make install PREFIX='D:\ocaml' # |
| 95 | + if: "steps.cache.outputs.cache-hit != 'true'" |
| 96 | + |
| 97 | + - name: Display configuration and set up PATH |
| 98 | + run: | |
| 99 | + D:\ocaml\bin\ocamlc -config |
| 100 | + D:\ocaml\bin\dune --version |
| 101 | + echo "D:\ocaml\bin" >> ${env:GITHUB_PATH} |
| 102 | +
|
| 103 | + - name: Save cache |
| 104 | + uses: actions/cache/save@v3 |
| 105 | + env: |
| 106 | + PATH: ${{ steps.pristine.outputs.pristine_path }} |
| 107 | + with: |
| 108 | + path: | |
| 109 | + C:\cygwin-packages |
| 110 | + D:\ocaml |
| 111 | + key: ${{ steps.key.outputs.cache_key }} |
| 112 | + if: "steps.cache.outputs.cache-hit != 'true'" |
| 113 | + |
| 114 | + - name: Fetch multicoretests |
| 115 | + uses: actions/checkout@v4 |
| 116 | + with: |
| 117 | + path: mct |
| 118 | + |
| 119 | + - name: Fetch QCheck |
| 120 | + uses: actions/checkout@v4 |
| 121 | + with: |
| 122 | + repository: c-cube/qcheck |
| 123 | + path: mct/qcheck |
| 124 | + |
| 125 | + - name: Build the test suite |
| 126 | + shell: bash -e {0} |
| 127 | + run: | |
| 128 | + eval $(ocaml/tools/msvs-promote-path) # |
| 129 | + cd mct # |
| 130 | + dune build # |
| 131 | +
|
| 132 | + - name: Run the test suite |
| 133 | + env: |
| 134 | + QCHECK_MSG_INTERVAL: 60 |
| 135 | + DUNE_CI_ALIAS: ${{ inputs.dune_alias }} |
| 136 | + run: | |
| 137 | + cd mct |
| 138 | + dune build "@ci" -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice |
0 commit comments