Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add native and bytecode workflows using MSVC #399

Merged
merged 9 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/msvc-530-trunk-bytecode.yml
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
12 changes: 12 additions & 0 deletions .github/workflows/msvc-530-trunk.yml
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
144 changes: 144 additions & 0 deletions .github/workflows/msvc-common.yml
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +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 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.

Expand Down
2 changes: 2 additions & 0 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
(MCTUTILS_TRUNCATE 50)))
)

(vendored_dirs qcheck)

;; make `dune build` target a recursive default target
(alias
(name default)
Expand Down
Loading