-
Notifications
You must be signed in to change notification settings - Fork 19
90 lines (89 loc) · 2.88 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: build
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest # macOS ARM64
# - macos-latest-large # macOS x86_64 # disabled because we're poor
- ubuntu-latest
# - windows-latest see #5
ocaml-compiler:
- "5.2"
include:
- os: ubuntu-latest
ocaml-compiler: "5.1"
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: checkout-submodules
run: |
git submodule update --init test/script/reference
git submodule update --init test/c/collections-c/files
mv .git .git.tmp # prevents opam from checking-out submodules
- name: cache
id: cache-opam
uses: actions/cache@v4
env:
cache-name: cache-opam-build
with:
path: |
~/work/owi/owi/_opam/
key: ${{ runner.os }}-build-${{ matrix.ocaml-compiler }}-${{ env.cache-name }}-${{ hashFiles('**/*.opam') }}
- name: setup-ocaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
opam-pin: true
allow-prerelease-opam: false
- name: depext
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew update
brew upgrade
brew install pkgconf
fi
if [ "$RUNNER_OS" == "linux" ]; then
apt update
fi
opam install . --depext-only --with-test --with-doc
- name: setup
if: steps.cache-opam.outputs.cache-hit != 'true'
run: |
opam install . --deps-only --with-test --with-doc
opam install smtml z3
opam install ocamlformat
opam clean --switch-cleanup
- name: build
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
export PATH="$(brew --prefix llvm@15)/bin/:$PATH" # macossucks
fi
opam exec -- dune build @install
- name: test
run: |
mv .git.tmp .git # bring it back, we won't call opam anymore from now on
if [ "$RUNNER_OS" == "macOS" ]; then
export PATH="$(brew --prefix llvm@15)/bin/:$PATH" # macossucks
fi
opam exec -- dune runtest
- name: lint-doc
run: |
ODOC_WARN_ERROR=true opam exec -- dune build @doc 2> output.txt || true
# $(exit $(wc -l output.txt | cut -d " " -f1))
- name: lint-fmt
run: |
opam exec -- dune build @fmt || (echo "\n⚠️ please run \`dune fmt\` and try again" && exit 1)
- name: lint-fresh-opam-file
run: |
git diff --exit-code owi.opam || (echo "⚠️ please run \`dune build\`, commit the changes to owi.opam, and then try again" && exit 1)