From 2ac110a0f71dad27af704fc07739da1964d3cd4a Mon Sep 17 00:00:00 2001 From: Samuel Hym Date: Thu, 28 Sep 2023 17:28:12 +0200 Subject: [PATCH 1/9] Mark `qcheck` directory as vendored Avoid running QCheck tests as part of a `dune runtest` even if it is vendored --- dune | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dune b/dune index 3a5412a4c..d436452d8 100644 --- a/dune +++ b/dune @@ -8,6 +8,8 @@ (MCTUTILS_TRUNCATE 50))) ) +(vendored_dirs qcheck) + ;; make `dune build` target a recursive default target (alias (name default) From ac0f88a5dee6ea52617bc5e3fe8a25e03c1f749a Mon Sep 17 00:00:00 2001 From: Samuel Hym Date: Thu, 28 Sep 2023 14:22:58 +0200 Subject: [PATCH 2/9] CI: Add native and bytecode workflows using MSVC Add a native workflow and a bytecode one using MSVC Run the bytecode-only in two parts, like Cygwin Use the current bleeding edge versions of dune and QCheck as they recently merged fixes that are relevant for these workflows Add badges for those two new workflows --- .github/workflows/msvc-bytecode.yml | 19 ++++ .github/workflows/msvc-common.yml | 144 ++++++++++++++++++++++++++++ .github/workflows/msvc-native.yml | 7 ++ README.md | 3 + 4 files changed, 173 insertions(+) create mode 100644 .github/workflows/msvc-bytecode.yml create mode 100644 .github/workflows/msvc-common.yml create mode 100644 .github/workflows/msvc-native.yml diff --git a/.github/workflows/msvc-bytecode.yml b/.github/workflows/msvc-bytecode.yml new file mode 100644 index 000000000..93d5c3416 --- /dev/null +++ b/.github/workflows/msvc-bytecode.yml @@ -0,0 +1,19 @@ +name: MSVC bytecode CI workflow + +on: [push, pull_request, workflow_dispatch] + +jobs: + part1: + uses: ./.github/workflows/msvc-common.yml + with: + bytecodeonly: true + dune_alias: 'ci1' + + part2: + needs: part1 + # Run part2 even if some test failed in part1: + if: ${{ always() }} + uses: ./.github/workflows/msvc-common.yml + with: + bytecodeonly: true + dune_alias: 'ci2' diff --git a/.github/workflows/msvc-common.yml b/.github/workflows/msvc-common.yml new file mode 100644 index 000000000..d73da250d --- /dev/null +++ b/.github/workflows/msvc-common.yml @@ -0,0 +1,144 @@ +name: Common MSVC CI workflow + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_call: + inputs: + bytecodeonly: + type: boolean + default: false + dune_alias: + description: 'dune alias that should be built in the main step' + type: string + default: 'runtest' + +jobs: + build: + permissions: {} + + runs-on: windows-latest + + steps: + - name: Save pristine PATH + id: pristine + run: | + echo "pristine_path=${env:Path}" >> "${env:GITHUB_OUTPUT}" + + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@v1 + + - name: Fetch OCaml + uses: actions/checkout@v4 + with: + repository: dra27/ocaml + ref: restore-msvc + path: ocaml + submodules: true + + - name: Choose a cache key + id: key + env: + BC_KEY_PART: ${{ inputs.bytecodeonly && '-bytecode' || '' }} + run: | + git -C ocaml rev-parse HEAD | Tee-Object -Variable sha + echo "cache_key=ocaml-msvc${env:BC_KEY_PART}-${sha}" | Tee-Object -FilePath "${env:GITHUB_OUTPUT}" + + - name: Restore cache + uses: actions/cache/restore@v3 + id: cache + env: + PATH: ${{ steps.pristine.outputs.pristine_path }} + with: + path: | + C:\cygwin-packages + D:\ocaml + key: ${{ steps.key.outputs.cache_key }} + + - name: Install Cygwin (Cygwin) + uses: cygwin/cygwin-install-action@v3 + with: + packages: make,bash + install-dir: 'D:\cygwin' + + - name: Build OCaml + shell: bash -e {0} + env: + NATIVE: ${{ inputs.bytecodeonly && '--disable-native-compiler' || '' }} + run: | + cd ocaml # + mkdir /cygdrive/d/ocaml # + eval $(tools/msvs-promote-path) # + ./configure --host=x86_64-pc-windows --with-flexdll --prefix=/cygdrive/d/ocaml $NATIVE # + make # + make install # + if: "steps.cache.outputs.cache-hit != 'true'" + + - name: Fetch dune + uses: actions/checkout@v4 + with: + repository: ocaml/dune + path: dune + if: "steps.cache.outputs.cache-hit != 'true'" + + - name: Compile dune + shell: bash -e {0} + run: | + export PATH="/cygdrive/d/ocaml/bin:$PATH" # + eval $(ocaml/tools/msvs-promote-path) # + export INCLUDE="$INCLUDE;$(cygpath -w "$PWD/ocaml/runtime/winpthreads/include")" # + cd dune # + make release # + make install PREFIX='D:\ocaml' # + if: "steps.cache.outputs.cache-hit != 'true'" + + - name: Display configuration and set up PATH + run: | + D:\ocaml\bin\ocamlc -config + D:\ocaml\bin\dune --version + echo "D:\ocaml\bin" >> ${env:GITHUB_PATH} + + - name: Save cache + uses: actions/cache/save@v3 + env: + PATH: ${{ steps.pristine.outputs.pristine_path }} + with: + path: | + C:\cygwin-packages + D:\ocaml + key: ${{ steps.key.outputs.cache_key }} + if: "steps.cache.outputs.cache-hit != 'true'" + + - name: Fetch multicoretests + uses: actions/checkout@v4 + with: + path: mct + + - name: Fetch QCheck + uses: actions/checkout@v4 + with: + repository: c-cube/qcheck + path: mct/qcheck + + - name: Build the test suite + shell: bash -e {0} + run: | + eval $(ocaml/tools/msvs-promote-path) # + cd mct # + dune build # + dune build test/ # + + - name: Run the internal package tests + run: | + cd mct + dune runtest -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice test/ + + - name: Run the multicore test suite + env: + QCHECK_MSG_INTERVAL: 60 + DUNE_CI_ALIAS: ${{ inputs.dune_alias }} + run: | + cd mct + dune build "@ci" -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice diff --git a/.github/workflows/msvc-native.yml b/.github/workflows/msvc-native.yml new file mode 100644 index 000000000..d214871a5 --- /dev/null +++ b/.github/workflows/msvc-native.yml @@ -0,0 +1,7 @@ +name: MSVC native CI workflow + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + uses: ./.github/workflows/msvc-common.yml diff --git a/README.md b/README.md index 85215eaf2..2ceedcdf0 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ Multicore tests [![MinGW 5.3.0+trunk-bytecode](https://github.com/ocaml-multicore/multicoretests/actions/workflows/mingw-530-trunk-bytecode.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/mingw-530-trunk-bytecode.yml) [![Cygwin 5.3.0+trunk](https://github.com/ocaml-multicore/multicoretests/actions/workflows/cygwin-530-trunk.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/cygwin-530-trunk.yml) +[![MSVC native](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-native.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-native.yml) +[![MSVC bytecode](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-bytecode.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-bytecode.yml) + Property-based tests of (parts of) the OCaml multicore compiler and run time. This project contains From 45067e056083100b08508a675669bf31714b69db Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:05:29 +0100 Subject: [PATCH 3/9] Target ocaml/ocaml after MSVC restoration was merged into trunk --- .github/workflows/msvc-common.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msvc-common.yml b/.github/workflows/msvc-common.yml index d73da250d..84dd76349 100644 --- a/.github/workflows/msvc-common.yml +++ b/.github/workflows/msvc-common.yml @@ -33,7 +33,7 @@ jobs: - name: Fetch OCaml uses: actions/checkout@v4 with: - repository: dra27/ocaml + repository: ocaml/ocaml ref: restore-msvc path: ocaml submodules: true From 20408b3daf3e4da3e6c82fe9d62488405a0a9bfe Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:07:16 +0100 Subject: [PATCH 4/9] Rename MSVC workflows to fit into current naming scheme --- .../workflows/{msvc-bytecode.yml => msvc-530-trunk-bytecode.yml} | 0 .github/workflows/{msvc-native.yml => msvc-530-trunk.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{msvc-bytecode.yml => msvc-530-trunk-bytecode.yml} (100%) rename .github/workflows/{msvc-native.yml => msvc-530-trunk.yml} (100%) diff --git a/.github/workflows/msvc-bytecode.yml b/.github/workflows/msvc-530-trunk-bytecode.yml similarity index 100% rename from .github/workflows/msvc-bytecode.yml rename to .github/workflows/msvc-530-trunk-bytecode.yml diff --git a/.github/workflows/msvc-native.yml b/.github/workflows/msvc-530-trunk.yml similarity index 100% rename from .github/workflows/msvc-native.yml rename to .github/workflows/msvc-530-trunk.yml From 270cd6c99805c20b148a02a1ebb0925625e04cd2 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:09:37 +0100 Subject: [PATCH 5/9] Adjust MSVC workflow titles --- .github/workflows/msvc-530-trunk-bytecode.yml | 2 +- .github/workflows/msvc-530-trunk.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/msvc-530-trunk-bytecode.yml b/.github/workflows/msvc-530-trunk-bytecode.yml index 93d5c3416..b5bd96169 100644 --- a/.github/workflows/msvc-530-trunk-bytecode.yml +++ b/.github/workflows/msvc-530-trunk-bytecode.yml @@ -1,4 +1,4 @@ -name: MSVC bytecode CI workflow +name: MSVC bytecode trunk on: [push, pull_request, workflow_dispatch] diff --git a/.github/workflows/msvc-530-trunk.yml b/.github/workflows/msvc-530-trunk.yml index d214871a5..d9822a48b 100644 --- a/.github/workflows/msvc-530-trunk.yml +++ b/.github/workflows/msvc-530-trunk.yml @@ -1,4 +1,4 @@ -name: MSVC native CI workflow +name: MSVC trunk on: [push, pull_request, workflow_dispatch] From d031ed7920d4da7a13e91b40843039e7b83b6d69 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:12:14 +0100 Subject: [PATCH 6/9] Avoid double push+PR MSVC runs on Jan's PRs --- .github/workflows/msvc-530-trunk-bytecode.yml | 7 ++++++- .github/workflows/msvc-530-trunk.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/msvc-530-trunk-bytecode.yml b/.github/workflows/msvc-530-trunk-bytecode.yml index b5bd96169..cd3db4edc 100644 --- a/.github/workflows/msvc-530-trunk-bytecode.yml +++ b/.github/workflows/msvc-530-trunk-bytecode.yml @@ -1,6 +1,11 @@ name: MSVC bytecode trunk -on: [push, pull_request, workflow_dispatch] +on: + pull_request: + push: + branches: + - main + workflow_dispatch: jobs: part1: diff --git a/.github/workflows/msvc-530-trunk.yml b/.github/workflows/msvc-530-trunk.yml index d9822a48b..2966edefc 100644 --- a/.github/workflows/msvc-530-trunk.yml +++ b/.github/workflows/msvc-530-trunk.yml @@ -1,6 +1,11 @@ name: MSVC trunk -on: [push, pull_request, workflow_dispatch] +on: + pull_request: + push: + branches: + - main + workflow_dispatch: jobs: build: From 980e1eddf3d7e158b091ad9015128abbf340753a Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:15:45 +0100 Subject: [PATCH 7/9] Update README badge titles and links --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2ceedcdf0..9b29930aa 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,8 @@ Multicore tests [![MinGW 5.3.0+trunk](https://github.com/ocaml-multicore/multicoretests/actions/workflows/mingw-530-trunk.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/mingw-530-trunk.yml) [![MinGW 5.3.0+trunk-bytecode](https://github.com/ocaml-multicore/multicoretests/actions/workflows/mingw-530-trunk-bytecode.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/mingw-530-trunk-bytecode.yml) [![Cygwin 5.3.0+trunk](https://github.com/ocaml-multicore/multicoretests/actions/workflows/cygwin-530-trunk.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/cygwin-530-trunk.yml) - -[![MSVC native](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-native.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-native.yml) -[![MSVC bytecode](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-bytecode.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-bytecode.yml) +[![MSVC 5.3.0+trunk](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-530-trunk.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-530-trunk.yml) +[![MSVC 5.3.0+trunk-bytecode](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-530-trunk-bytecode.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/msvc-530-trunk-bytecode.yml) Property-based tests of (parts of) the OCaml multicore compiler and run time. From 30a5af4940b45d80d51cbf990ec9068b614304e4 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:24:24 +0100 Subject: [PATCH 8/9] Fetch 'trunk' branch - not 'restore-msvc' branch --- .github/workflows/msvc-common.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/msvc-common.yml b/.github/workflows/msvc-common.yml index 84dd76349..de7aca80a 100644 --- a/.github/workflows/msvc-common.yml +++ b/.github/workflows/msvc-common.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4 with: repository: ocaml/ocaml - ref: restore-msvc + ref: trunk path: ocaml submodules: true From 9ce6e3ecedc1d14e2119e4f0e39d786cc3a01ecd Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Tue, 26 Mar 2024 16:47:20 +0100 Subject: [PATCH 9/9] Update MSVC bytecode workflow to use only 1 part --- .github/workflows/msvc-530-trunk-bytecode.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/msvc-530-trunk-bytecode.yml b/.github/workflows/msvc-530-trunk-bytecode.yml index cd3db4edc..d2a548d62 100644 --- a/.github/workflows/msvc-530-trunk-bytecode.yml +++ b/.github/workflows/msvc-530-trunk-bytecode.yml @@ -8,17 +8,7 @@ on: workflow_dispatch: jobs: - part1: + build: uses: ./.github/workflows/msvc-common.yml with: bytecodeonly: true - dune_alias: 'ci1' - - part2: - needs: part1 - # Run part2 even if some test failed in part1: - if: ${{ always() }} - uses: ./.github/workflows/msvc-common.yml - with: - bytecodeonly: true - dune_alias: 'ci2'