Skip to content

Commit

Permalink
CI: Add native and bytecode workflows using MSVC
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shym committed Oct 6, 2023
1 parent 43fd191 commit e884272
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/msvc-bytecode.yml
Original file line number Diff line number Diff line change
@@ -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'
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: 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
7 changes: 7 additions & 0 deletions .github/workflows/msvc-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: MSVC native CI workflow

on: [push, pull_request, workflow_dispatch]

jobs:
build:
uses: ./.github/workflows/msvc-common.yml
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Multicore tests
[![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)
[![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)

[![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
Expand Down

0 comments on commit e884272

Please sign in to comment.