Skip to content

Commit 62328ff

Browse files
authored
Merge pull request #3131 from o1-labs/include-macos-ci
CI: include macos-latest
2 parents 8d861d0 + 8af49df commit 62328ff

File tree

4 files changed

+93
-40
lines changed

4 files changed

+93
-40
lines changed

.github/actions/build-mips/action.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,39 @@ description: 'Builds MIPS programs for testing'
44
runs:
55
using: "composite"
66
steps:
7-
- name: Cache apt packages
7+
- name: Cache apt packages (Linux)
8+
if: runner.os == 'Linux'
89
uses: actions/cache@v4
910
with:
1011
path: |
1112
/var/cache/apt/archives/*.deb
1213
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/o1vm-mips-build.yml') }}
1314

14-
- name: Install MIPS tools
15+
- name: Install MIPS tools (Linux)
16+
if: runner.os == 'Linux'
1517
shell: bash
1618
run: |
1719
sudo apt-get update
1820
sudo apt-get install -y binutils-mips-linux-gnu
1921
20-
- name: Build MIPS programs
22+
- name: Install MIPS tools (macOS)
23+
if: runner.os == 'macOS'
2124
shell: bash
22-
run: make build-mips-programs
25+
run: |
26+
# Pull the dockcross MIPS image for cross-compilation
27+
docker pull dockcross/linux-mips:latest
28+
29+
- name: Build MIPS programs (Linux)
30+
if: runner.os == 'Linux'
31+
shell: bash
32+
run: make build-mips-programs
33+
34+
- name: Build MIPS programs (macOS)
35+
if: runner.os == 'macOS'
36+
shell: bash
37+
run: |
38+
# Use dockcross Docker image for MIPS cross-compilation on macOS
39+
docker run --rm -v $(pwd):/work dockcross/linux-mips:latest bash -c "
40+
cd /work &&
41+
make build-mips-programs MIPS_AS=mips-linux-gnu-as MIPS_LD=mips-linux-gnu-ld
42+
"

.github/workflows/ci.yml

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,45 @@ jobs:
3030
define-matrix:
3131
runs-on: ubuntu-latest
3232
outputs:
33-
rust_toolchain_version: ${{ steps.rust.outputs.version }}
34-
default_rust_version: ${{ fromJson(steps.rust.outputs.version)[0] }}
3533
ocaml_version: ${{ steps.ocaml.outputs.version }}
3634
node: ${{ steps.node.outputs.version }}
37-
os: ${{ steps.os.outputs.version }}
38-
default_os: ${{ fromJson(steps.os.outputs.version)[0] }}
35+
matrix: ${{ steps.matrix.outputs.value }}
36+
default_rust_version: ${{ steps.defaults.outputs.rust_version }}
37+
default_os: ${{ steps.defaults.outputs.os }}
3938
steps:
40-
- id: rust
41-
run: echo 'version=["1.81", "1.82"]' >> "$GITHUB_OUTPUT"
4239
# FIXME: currently not available for 5.0.0.
4340
# It might be related to boxroot dependency, and we would need to bump
4441
# up the ocaml-rs dependency
4542
- id: ocaml
4643
run: echo 'version=["4.14.2"]' >> "$GITHUB_OUTPUT"
4744
- id: node
4845
run: echo 'version=["20"]' >> "$GITHUB_OUTPUT"
49-
- id: os
50-
run: echo 'version=["ubuntu-latest", "ubuntu-24.04-arm"]' >> "$GITHUB_OUTPUT"
46+
- id: defaults
47+
run: |
48+
echo 'rust_version=1.81' >> "$GITHUB_OUTPUT"
49+
echo 'os=ubuntu-latest' >> "$GITHUB_OUTPUT"
50+
- id: matrix
51+
run: |
52+
# NOTE: This custom matrix configuration is needed to use Rust 1.84 specifically for macOS.
53+
# When https://github.com/o1-labs/proof-systems/issues/3254 is fixed,
54+
# this can be simplified to use a standard matrix configuration.
55+
cat > matrix.json << 'EOF'
56+
{
57+
"include": [
58+
{"rust_toolchain_version": "1.81", "os": "ubuntu-latest"},
59+
{"rust_toolchain_version": "1.82", "os": "ubuntu-latest"},
60+
{"rust_toolchain_version": "1.81", "os": "ubuntu-24.04-arm"},
61+
{"rust_toolchain_version": "1.82", "os": "ubuntu-24.04-arm"},
62+
{"rust_toolchain_version": "1.84", "os": "macos-latest"}
63+
]
64+
}
65+
EOF
66+
echo "value=$(cat matrix.json | jq -c .)" >> "$GITHUB_OUTPUT"
5167
5268
refresh-cache:
5369
needs: ['define-matrix']
5470
strategy:
55-
matrix:
56-
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }}
57-
os: ${{ fromJSON(needs.define-matrix.outputs.os) }}
71+
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
5872
runs-on: ${{ matrix.os }}
5973
steps:
6074
# if 'workflow_run'
@@ -64,7 +78,7 @@ jobs:
6478
- uses: ./.github/actions/toolchain-shared
6579
if: ${{ github.event_name == 'workflow_run' }}
6680
with:
67-
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
81+
rust_toolchain_version: ${{ matrix.rust_and_os.rust_toolchain_version }}
6882
- name: start-fresh
6983
if: ${{ github.event_name == 'workflow_run' }}
7084
shell: bash
@@ -81,11 +95,14 @@ jobs:
8195
needs: ['define-matrix', 'refresh-cache']
8296
strategy:
8397
matrix:
84-
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }}
98+
rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }}
8599
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }}
86100
node: ${{ fromJSON(needs.define-matrix.outputs.node) }}
87-
os: ${{ fromJSON(needs.define-matrix.outputs.os) }}
88-
runs-on: ${{ matrix.os }}
101+
exclude:
102+
# Skip Rust 1.84 due to linting issues - remove when
103+
# https://github.com/o1-labs/proof-systems/pull/3245 is fixed
104+
- rust_and_os: {rust_toolchain_version: '1.84', os: 'macos-latest'}
105+
runs-on: ${{ matrix.rust_and_os.os }}
89106
steps:
90107
- name: Checkout repository
91108
uses: actions/checkout@v5
@@ -100,7 +117,7 @@ jobs:
100117
- name: Use shared Rust toolchain setting up steps
101118
uses: ./.github/actions/toolchain-shared
102119
with:
103-
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
120+
rust_toolchain_version: ${{ matrix.rust_and_os.rust_toolchain_version }}
104121

105122
- name: Use shared OCaml setting up steps
106123
uses: ./.github/actions/ocaml-shared
@@ -159,10 +176,10 @@ jobs:
159176

160177
- name: Rerun doc generation with different args and copy into book directory
161178
if: >-
162-
github.event_name == 'push' &&
179+
github.event_name == 'push' &&
163180
github.ref == 'refs/heads/master' &&
164-
matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version &&
165-
matrix.os == needs.define-matrix.outputs.default_os
181+
matrix.rust_and_os.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version &&
182+
matrix.rust_and_os.os == needs.define-matrix.outputs.default_os
166183
run: |
167184
eval $(opam env)
168185
RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all-features --no-deps --workspace --exclude xtask
@@ -171,10 +188,10 @@ jobs:
171188
- name: Deploy
172189
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
173190
if: >-
174-
github.event_name == 'push' &&
191+
github.event_name == 'push' &&
175192
github.ref == 'refs/heads/master' &&
176-
matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version &&
177-
matrix.os == needs.define-matrix.outputs.default_os
193+
matrix.rust_and_os.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version &&
194+
matrix.rust_and_os.os == needs.define-matrix.outputs.default_os
178195
with:
179196
github_token: ${{ secrets.GITHUB_TOKEN }}
180197
publish_dir: ./book/book/html
@@ -183,11 +200,14 @@ jobs:
183200
needs: ['define-matrix', 'refresh-cache']
184201
strategy:
185202
matrix:
186-
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }}
203+
rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }}
187204
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }}
188205
node: ${{ fromJSON(needs.define-matrix.outputs.node) }}
189-
os: ${{ fromJSON(needs.define-matrix.outputs.os) }}
190-
runs-on: ${{ matrix.os }}
206+
exclude:
207+
# Skip Rust 1.84 due to linting issues - remove when
208+
# https://github.com/o1-labs/proof-systems/pull/3245 is fixed
209+
- rust_and_os: {rust_toolchain_version: '1.84', os: 'macos-latest'}
210+
runs-on: ${{ matrix.rust_and_os.os }}
191211
steps:
192212
- name: Checkout repository
193213
uses: actions/checkout@v5
@@ -197,7 +217,7 @@ jobs:
197217
- name: Use shared Rust toolchain setting up steps
198218
uses: ./.github/actions/toolchain-shared
199219
with:
200-
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
220+
rust_toolchain_version: ${{ matrix.rust_and_os.rust_toolchain_version }}
201221

202222
- name: Use shared OCaml setting up steps
203223
uses: ./.github/actions/ocaml-shared
@@ -216,11 +236,10 @@ jobs:
216236
needs: ['define-matrix', 'refresh-cache']
217237
strategy:
218238
matrix:
219-
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }}
239+
rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }}
220240
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }}
221241
node: ${{ fromJSON(needs.define-matrix.outputs.node) }}
222-
os: ${{ fromJSON(needs.define-matrix.outputs.os) }}
223-
runs-on: ${{ matrix.os }}
242+
runs-on: ${{ matrix.rust_and_os.os }}
224243
steps:
225244
- name: Checkout repository
226245
uses: actions/checkout@v5
@@ -230,7 +249,7 @@ jobs:
230249
- name: Use shared Rust toolchain setting up steps
231250
uses: ./.github/actions/toolchain-shared
232251
with:
233-
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
252+
rust_toolchain_version: ${{ matrix.rust_and_os.rust_toolchain_version }}
234253

235254
- name: Use shared OCaml setting up steps
236255
uses: ./.github/actions/ocaml-shared
@@ -249,11 +268,14 @@ jobs:
249268
needs: ['define-matrix', 'refresh-cache']
250269
strategy:
251270
matrix:
252-
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }}
271+
rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }}
253272
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }}
254273
node: ${{ fromJSON(needs.define-matrix.outputs.node) }}
255-
os: ${{ fromJSON(needs.define-matrix.outputs.os) }}
256-
runs-on: ${{ matrix.os }}
274+
exclude:
275+
# Skip Rust 1.84 due to linting issues - remove when
276+
# https://github.com/o1-labs/proof-systems/pull/3245 is fixed
277+
- rust_and_os: {rust_toolchain_version: '1.84', os: 'macos-latest'}
278+
runs-on: ${{ matrix.rust_and_os.os }}
257279
steps:
258280
- name: Checkout repository
259281
uses: actions/checkout@v5
@@ -263,7 +285,7 @@ jobs:
263285
- name: Use shared Rust toolchain setting up steps
264286
uses: ./.github/actions/toolchain-shared
265287
with:
266-
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}
288+
rust_toolchain_version: ${{ matrix.rust_and_os.rust_toolchain_version }}
267289
components: llvm-tools-preview
268290

269291
- name: Use shared OCaml setting up steps

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [Unreleased]
1010

11+
### CI
12+
13+
#### Added
14+
15+
- CI: add support for macos-latest with Rust 1.84
16+
([#3131](https://github.com/o1-labs/proof-systems/pull/3131))
17+
1118
### [arrabbiata](./arrabbiata)
1219

1320
#### Changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ O1VM_MIPS_SOURCE_FILES = $(patsubst ${OPTIMISM_MIPS_SOURCE_DIR}/%.asm,${O1VM_MIP
2525
O1VM_MIPS_BIN_DIR = ${O1VM_RESOURCES_PATH}/mips/bin
2626
O1VM_MIPS_BIN_FILES = $(patsubst ${O1VM_MIPS_SOURCE_DIR}/%.asm,${O1VM_MIPS_BIN_DIR}/%.o,${O1VM_MIPS_SOURCE_FILES})
2727

28+
# MIPS toolchain configuration (can be overridden for different platforms)
29+
MIPS_AS ?= mips-linux-gnu-as
30+
MIPS_LD ?= mips-linux-gnu-ld
31+
2832
# This should be updated if rust-toolchain.toml is updated, and the nightly
2933
# version should be close to the date of the release of the stable version used
3034
# in rust-toolchain.toml.
@@ -229,8 +233,8 @@ ${O1VM_MIPS_SOURCE_DIR}/%.asm: ${OPTIMISM_MIPS_SOURCE_DIR}/%.asm
229233
${O1VM_MIPS_BIN_DIR}/%.o: ${O1VM_MIPS_SOURCE_DIR}/%.asm
230234
@echo "Building the MIPS binary: $(basename $@) using $<"
231235
@mkdir -p ${O1VM_MIPS_BIN_DIR}
232-
@mips-linux-gnu-as -defsym big_endian=1 -march=mips32r2 -o $@ $<
233-
@mips-linux-gnu-ld -s -o $(basename $@) $@
236+
@${MIPS_AS} -defsym big_endian=1 -march=mips32r2 -o $@ $<
237+
@${MIPS_LD} -s -o $(basename $@) $@
234238

235239
fclean: clean ## Clean the tooling artefacts in addition to running clean
236240
rm -rf ${RISCV32_TOOLCHAIN_PATH}

0 commit comments

Comments
 (0)