Skip to content

Commit 166b4a8

Browse files
authored
Merge pull request #399 from shym/msvc-workflows
CI: Add native and bytecode workflows using MSVC
2 parents ed69ba9 + 9ce6e3e commit 166b4a8

File tree

5 files changed

+174
-0
lines changed

5 files changed

+174
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: MSVC bytecode trunk
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
uses: ./.github/workflows/msvc-common.yml
13+
with:
14+
bytecodeonly: true

.github/workflows/msvc-530-trunk.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: MSVC trunk
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
uses: ./.github/workflows/msvc-common.yml

.github/workflows/msvc-common.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
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: ocaml/ocaml
37+
ref: trunk
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+
dune build test/ #
132+
133+
- name: Run the internal package tests
134+
run: |
135+
cd mct
136+
dune runtest -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice test/
137+
138+
- name: Run the multicore test suite
139+
env:
140+
QCHECK_MSG_INTERVAL: 60
141+
DUNE_CI_ALIAS: ${{ inputs.dune_alias }}
142+
run: |
143+
cd mct
144+
dune build "@ci" -j1 --no-buffer --display=quiet --cache=disabled --error-reporting=twice

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Multicore tests
4040
[![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)
4141
[![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)
4242
[![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)
43+
[![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)
44+
[![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)
4345

4446
Property-based tests of (parts of) the OCaml multicore compiler and run time.
4547

dune

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
(MCTUTILS_TRUNCATE 50)))
99
)
1010

11+
(vendored_dirs qcheck)
12+
1113
;; make `dune build` target a recursive default target
1214
(alias
1315
(name default)

0 commit comments

Comments
 (0)