Skip to content

Commit 87fc662

Browse files
committed
ci: split into Ubuntu and macOS workflows, drop Rust < 1.81
1 parent a7477ae commit 87fc662

File tree

6 files changed

+140
-93
lines changed

6 files changed

+140
-93
lines changed

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Required for macOS support with ocaml-rs
2+
# See https://github.com/zshipko/ocaml-rs
3+
[build]
4+
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Test
2+
description: Setup environment and run tests
3+
4+
inputs:
5+
rust_toolchain_version:
6+
description: Rust toolchain version
7+
required: true
8+
ocaml_version:
9+
description: OCaml version
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Setup Rust toolchain ${{ inputs.rust_toolchain_version }}
16+
uses: dtolnay/rust-toolchain@master
17+
with:
18+
toolchain: ${{ inputs.rust_toolchain_version }}
19+
components: clippy
20+
21+
- name: Install Rust nightly for formatting
22+
shell: bash
23+
run: rustup toolchain install nightly --component rustfmt
24+
25+
- name: Set macOS linker flags
26+
if: runner.os == 'macOS'
27+
shell: bash
28+
run: echo "RUSTFLAGS=$RUSTFLAGS -C link-args=-Wl,-undefined,dynamic_lookup" >> $GITHUB_ENV
29+
30+
- name: Setup OCaml ${{ inputs.ocaml_version }}
31+
uses: ocaml/setup-ocaml@v3
32+
with:
33+
ocaml-compiler: ${{ inputs.ocaml_version }}
34+
35+
- name: Setup OCaml dependencies
36+
shell: bash
37+
run: |
38+
eval $(opam env)
39+
make setup-ocaml-deps
40+
41+
- name: List OCaml and Rust versions
42+
shell: bash
43+
run: |
44+
eval $(opam env)
45+
echo "OCaml version $(ocamlc --version) (location = $(which ocamlc))"
46+
echo "OPAM version $(opam --version) (location = $(which opam))"
47+
echo "Rust version $(rustc --version) (location = $(which rustc))"
48+
49+
- name: Enforce Rust and OCaml formatting
50+
shell: bash
51+
run: |
52+
eval $(opam env)
53+
cargo install cargo-sort --version 1.0.9
54+
make check-format
55+
56+
- name: Lint (clippy)
57+
shell: bash
58+
run: |
59+
eval $(opam env)
60+
make lint
61+
62+
- name: Build and run tests
63+
shell: bash
64+
run: |
65+
eval $(opam env)
66+
dune build
67+
dune runtest
68+
69+
- name: Check that up-to-date bindings are checked in
70+
shell: bash
71+
run: |
72+
git diff --exit-code ":(exclude)rust-toolchain"

.github/workflows/build-macos.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build macOS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
RUSTFLAGS: -Coverflow-checks=y -Cdebug-assertions=y
11+
CARGO_INCREMENTAL: 1
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
rust_toolchain_version: ["1.81", "1.82", "stable"]
19+
# OCaml 5 not supported on macOS yet
20+
ocaml_version: [4.14]
21+
runs-on: macos-latest
22+
name: Rust ${{ matrix.rust_toolchain_version }}, OCaml ${{ matrix.ocaml_version }}
23+
steps:
24+
- name: Checkout PR
25+
uses: actions/checkout@v4
26+
27+
- name: Build and test
28+
uses: ./.github/actions/build-and-test
29+
with:
30+
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
31+
ocaml_version: ${{ matrix.ocaml_version }}

.github/workflows/build-ubuntu.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build Ubuntu
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
RUSTFLAGS: -Coverflow-checks=y -Cdebug-assertions=y
11+
CARGO_INCREMENTAL: 1
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
rust_toolchain_version: ["1.81", "1.82", "stable"]
19+
ocaml_version: [4.14, 5.2]
20+
os: ["ubuntu-latest", "ubuntu-24.04-arm"]
21+
runs-on: ${{ matrix.os }}
22+
name: Rust ${{ matrix.rust_toolchain_version }}, OCaml ${{ matrix.ocaml_version }}, ${{ matrix.os }}
23+
steps:
24+
- name: Checkout PR
25+
uses: actions/checkout@v4
26+
27+
- name: Build and test
28+
uses: ./.github/actions/build-and-test
29+
with:
30+
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
31+
ocaml_version: ${{ matrix.ocaml_version }}

.github/workflows/ci.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- **Dependencies**: bump ocaml-rs from `0.22.4` to `1.3.0` to support OCaml5
1313
- **CI**: add stable Rust version to test matrix
1414
([#46](https://github.com/o1-labs/ocaml-gen/pull/46))
15+
- **CI**: add macos-latest runner, drop Rust versions below 1.81
16+
([#47](https://github.com/o1-labs/ocaml-gen/pull/47))
1517

1618
## 1.0.0
1719

0 commit comments

Comments
 (0)