Skip to content

Support ocaml 5.2

Support ocaml 5.2 #228

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [
macos-13, # x64
macos-14, # ARM
ubuntu-latest,
windows-latest,
]
target: [rescript]
# syntax explanation:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
include:
- os: macos-13
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
test: npm test
artifact-folder: darwin
- os: macos-14
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
test: npm test
artifact-folder: darwinarm64
- os: ubuntu-latest
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
test: npm test
artifact-folder: linux
- os: windows-latest
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
artifact-folder: win32
- os: ubuntu-latest
target: ocaml.4.08
ocaml-compiler: 4.08.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.4.14
ocaml-compiler: 4.14.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.5.0
ocaml-compiler: 5.0.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.5.1
ocaml-compiler: 5.1.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.5.2
ocaml-compiler: 5.2.x
build: opam exec -- dune build
runs-on: ${{matrix.os}}
steps:
# needed for Windows testing
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- name: Cache OCaml's opam
uses: actions/cache@v4
with:
path: ~/.opam
key: ${{matrix.os}}-reanalyze-v2
- name: Use OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{matrix.ocaml-compiler}}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: opam install dune cppo
- name: Build
run: ${{matrix.build}}
- name: Test
if: matrix.target == 'rescript'
run: ${{matrix.test}}
# Also avoids artifacts upload permission loss:
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss
- name: Compress files
if: matrix.target == 'rescript'
run: |
mkdir ${{matrix.artifact-folder}}
cp _build/default/src/Reanalyze.exe reanalyze.exe
tar -cvf binary.tar reanalyze.exe
- uses: actions/upload-artifact@v4
if: matrix.target == 'rescript'
with:
name: ${{matrix.os}}
path: binary.tar
npm_pack:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: download binaries
uses: actions/download-artifact@v4
- name: Pack reanalyze
run: |
# Put the built artifacts in the appropriate package folder
tar xf macos-13/binary.tar -C dist/vendor-darwin
tar xf macos-14/binary.tar -C dist/vendor-darwinarm64
tar xf ubuntu-latest/binary.tar -C dist/vendor-linux
tar xf windows-latest/binary.tar -C dist/vendor-win32
# Add the correct package.json / README / etc to dist
node scripts/prepare_release.js
# Pack everything up
cd dist
npm pack
cd ..
mv dist/reanalyze-*.tgz reanalyze-npm.tgz
- name: upload reanalyze-npm.tgz
uses: actions/upload-artifact@v4
with:
name: reanalyze-npm.tgz
path: reanalyze-npm.tgz