chore: update CI to github actions 2

This commit is contained in:
Simon Cruanes 2021-07-30 12:42:56 -04:00
parent 70222b0395
commit 066577c4db

View file

@ -1,7 +1,4 @@
name: build name: build
# adapted from ocaml-containers and @fardale's hard work.
on: on:
push: push:
branches: branches:
@ -9,69 +6,27 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
jobs: jobs:
run: run:
name: Build name: Build
strategy: strategy:
fail-fast: false
matrix: matrix:
os: os:
- macos-latest - macos-latest
- ubuntu-latest - ubuntu-latest
- windows-latest - windows-latest
ocaml: ocaml-compiler:
- '4.08.1' - 4.08.x
- '4.12.0' - 4.12.x
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: haya14busa/action-cond@v1 - uses: actions/checkout@v2
id: path - uses: ocaml/setup-ocaml@v2
with: with:
cond: ${{ matrix.os == 'windows-latest' }} ocaml-compiler: ${{ matrix.ocaml-compiler }}
if_true: "D:\\cygwin\\home\\runneradmin\\.opam"
if_false: "~/.opam"
- name: Checkout code
uses: actions/checkout@main
- name: Cache opam
id: cache-opam
uses: actions/cache@v2
with:
path: ${{ steps.path.outputs.value }}
key: opam-${{ matrix.os }}-${{ matrix.ocaml }}
- name: Use OCaml ${{ matrix.ocaml }}
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml }}
- run: opam update -u
if: steps.cache-opam.outputs.cache-hit == 'true'
- run: opam pin -n . - run: opam pin -n .
- run: opam depext -yt linol linol-lwt - run: opam depext -yt linol linol-lwt
- run: opam install -t . --deps-only
- run: opam install -t linol linol-lwt --deps-only
if: matrix.os == 'ubuntu-latest'
- run: |
opam install -t linol --deps-only
opam install linol-lwt --deps-only # no test deps
if: matrix.os != 'ubuntu-latest'
- run: opam exec -- dune build - run: opam exec -- dune build
- run: opam exec -- dune runtest - run: opam exec -- dune runtest
if: ${{ matrix.os == 'ubuntu-latest' }} if: ${{ matrix.os == 'ubuntu-latest'}}
- run: opam exec -- dune runtest -j 1 -p linol # test only core on non-ubuntu platform
if: ${{ matrix.os != 'ubuntu-latest' }}
- name: Remove troublesome files for caching on windows
if: matrix.os == 'windows-latest'
run: |
if (Test-Path D:\\cygwin\\home\\runneradmin\\.opam\\ocaml-variants.${{ matrix.ocaml }}+mingw64c\\.opam-switch\\sources\\ocamlbuild.0.14.0\\examples\\){Remove-Item path D:\\cygwin\\home\\runneradmin\\.opam\\ocaml-variants.${{ matrix.ocaml }}+mingw64c\\.opam-switch\\sources\\ocamlbuild.0.14.0\\examples\\ recurse}