-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from shym/msvc-workflows
CI: Add native and bytecode workflows using MSVC
- Loading branch information
Showing
5 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: MSVC bytecode trunk | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/msvc-common.yml | ||
with: | ||
bytecodeonly: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: MSVC trunk | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/msvc-common.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ocaml/ocaml | ||
ref: trunk | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters