Skip to content

Commit 135dd49

Browse files
committed
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
1 parent 43fd191 commit 135dd49

File tree

4 files changed

+167
-0
lines changed

4 files changed

+167
-0
lines changed

.github/workflows/msvc-bytecode.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: MSVC bytecode CI workflow
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
part1:
7+
uses: ./.github/workflows/msvc-common.yml
8+
with:
9+
bytecodeonly: true
10+
dune_alias: 'ci1'
11+
12+
part2:
13+
needs: part1
14+
# Run part2 even if some test failed in part1:
15+
if: ${{ always() }}
16+
uses: ./.github/workflows/msvc-common.yml
17+
with:
18+
bytecodeonly: true
19+
dune_alias: 'ci2'

.github/workflows/msvc-common.yml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
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

.github/workflows/msvc-native.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: MSVC native CI workflow
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
uses: ./.github/workflows/msvc-common.yml

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Multicore tests
3131
[![Windows 5.2.0+trunk-bytecode](https://github.com/ocaml-multicore/multicoretests/actions/workflows/windows-520-trunk-bytecode.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/windows-520-trunk-bytecode.yml)
3232
[![Cygwin 5.2.0+trunk](https://github.com/ocaml-multicore/multicoretests/actions/workflows/cygwin-520-trunk.yml/badge.svg)](https://github.com/ocaml-multicore/multicoretests/actions/workflows/cygwin-520-trunk.yml)
3333

34+
[![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)
35+
[![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)
36+
3437
Property-based tests of (parts of) the OCaml multicore compiler and run time.
3538

3639
This project contains

0 commit comments

Comments
 (0)