Skip to content

Commit 07d687c

Browse files
committed
CI: generalize build jobs to multiple platforms
- Add matrix strategy to build, build_wasm, build-tests, and build-tests-webrtc jobs - Support ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, and macos-latest - Add platform-specific dependency installation (apt vs brew) - Update artifact names to include OS identifier to avoid conflicts This enables testing builds across multiple platforms while maintaining the same functionality.
1 parent cf67d94 commit 07d687c

File tree

1 file changed

+82
-46
lines changed

1 file changed

+82
-46
lines changed

.github/workflows/ci.yaml

Lines changed: 82 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717

1818
jobs:
1919
ledger-tests:
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-latest
2121
steps:
2222
- name: Git checkout
2323
uses: actions/checkout@v4
@@ -40,7 +40,7 @@ jobs:
4040
make test-ledger
4141
4242
ledger-32x9-tests:
43-
runs-on: ubuntu-22.04
43+
runs-on: ubuntu-latest
4444
steps:
4545
- name: Git checkout
4646
uses: actions/checkout@v4
@@ -70,7 +70,7 @@ jobs:
7070
make test-ledger
7171
7272
vrf-tests:
73-
runs-on: ubuntu-22.04
73+
runs-on: ubuntu-latest
7474
steps:
7575
- name: Git checkout
7676
uses: actions/checkout@v4
@@ -90,7 +90,7 @@ jobs:
9090
make test-vrf
9191
9292
p2p-tests:
93-
runs-on: ubuntu-22.04
93+
runs-on: ubuntu-latest
9494
steps:
9595
- name: Git checkout
9696
uses: actions/checkout@v4
@@ -116,16 +116,25 @@ jobs:
116116
make test-p2p
117117
118118
build:
119-
runs-on: ubuntu-22.04
119+
strategy:
120+
matrix:
121+
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-latest]
122+
runs-on: ${{ matrix.os }}
120123
steps:
121124
- name: Git checkout
122125
uses: actions/checkout@v4
123126

124-
- name: Setup build dependencies
127+
- name: Setup build dependencies (Ubuntu)
128+
if: startsWith(matrix.os, 'ubuntu')
125129
run: |
126130
sudo apt update
127131
sudo apt install -y protobuf-compiler
128132
133+
- name: Setup build dependencies (macOS)
134+
if: startsWith(matrix.os, 'macos')
135+
run: |
136+
brew install protobuf
137+
129138
- name: Setup Rust
130139
uses: dtolnay/rust-toolchain@stable
131140
with:
@@ -144,51 +153,69 @@ jobs:
144153
- name: Upload binaries
145154
uses: actions/upload-artifact@v4
146155
with:
147-
name: bin
156+
name: bin-${{ matrix.os }}
148157
path: target/release/openmina
149158

150159
build_wasm:
151-
runs-on: ubuntu-22.04
152-
steps:
153-
- name: Git checkout
154-
uses: actions/checkout@v4
155-
156-
- name: Setup build dependencies
157-
run: |
158-
sudo apt update
159-
sudo apt install -y protobuf-compiler
160-
161-
- name: Setup Rust
162-
uses: dtolnay/rust-toolchain@stable
163-
with:
164-
components: rustfmt, rust-src
165-
toolchain: nightly
166-
167-
- name: Install wasm32 and wasm-bindgen-cli
168-
run: |
169-
rustup target add wasm32-unknown-unknown
170-
cargo install -f wasm-bindgen-cli --version 0.2.99
171-
172-
- name: Setup Rust Cache
173-
uses: Swatinem/rust-cache@v2
174-
with:
175-
prefix-key: "v0"
176-
177-
- name: Release build
178-
run: |
179-
make build-wasm
160+
strategy:
161+
matrix:
162+
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-latest]
163+
runs-on: ${{ matrix.os }}
164+
steps:
165+
- name: Git checkout
166+
uses: actions/checkout@v4
167+
168+
- name: Setup build dependencies (Ubuntu)
169+
if: startsWith(matrix.os, 'ubuntu')
170+
run: |
171+
sudo apt update
172+
sudo apt install -y protobuf-compiler
173+
174+
- name: Setup build dependencies (macOS)
175+
if: startsWith(matrix.os, 'macos')
176+
run: |
177+
brew install protobuf
178+
179+
- name: Setup Rust
180+
uses: dtolnay/rust-toolchain@stable
181+
with:
182+
components: rustfmt, rust-src
183+
toolchain: nightly
184+
185+
- name: Install wasm32 and wasm-bindgen-cli
186+
run: |
187+
rustup target add wasm32-unknown-unknown
188+
cargo install -f wasm-bindgen-cli --version 0.2.99
189+
190+
- name: Setup Rust Cache
191+
uses: Swatinem/rust-cache@v2
192+
with:
193+
prefix-key: "v0"
194+
195+
- name: Release build
196+
run: |
197+
make build-wasm
180198
181199
build-tests:
182-
runs-on: ubuntu-22.04
200+
strategy:
201+
matrix:
202+
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-latest]
203+
runs-on: ${{ matrix.os }}
183204
steps:
184205
- name: Git checkout
185206
uses: actions/checkout@v4
186207

187-
- name: Setup build dependencies
208+
- name: Setup build dependencies (Ubuntu)
209+
if: startsWith(matrix.os, 'ubuntu')
188210
run: |
189211
sudo apt update
190212
sudo apt install -y protobuf-compiler
191213
214+
- name: Setup build dependencies (macOS)
215+
if: startsWith(matrix.os, 'macos')
216+
run: |
217+
brew install protobuf
218+
192219
- name: Setup Rust
193220
uses: dtolnay/rust-toolchain@stable
194221
with:
@@ -212,20 +239,29 @@ jobs:
212239
- name: Upload tests
213240
uses: actions/upload-artifact@v4
214241
with:
215-
name: tests
242+
name: tests-${{ matrix.os }}
216243
path: target/release/tests
217244

218245
build-tests-webrtc:
219-
runs-on: ubuntu-22.04
246+
strategy:
247+
matrix:
248+
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-latest]
249+
runs-on: ${{ matrix.os }}
220250
steps:
221251
- name: Git checkout
222252
uses: actions/checkout@v4
223253

224-
- name: Setup build dependencies
254+
- name: Setup build dependencies (Ubuntu)
255+
if: startsWith(matrix.os, 'ubuntu')
225256
run: |
226257
sudo apt update
227258
sudo apt install -y protobuf-compiler
228259
260+
- name: Setup build dependencies (macOS)
261+
if: startsWith(matrix.os, 'macos')
262+
run: |
263+
brew install protobuf
264+
229265
- name: Setup Rust
230266
uses: dtolnay/rust-toolchain@stable
231267
with:
@@ -244,12 +280,12 @@ jobs:
244280
- name: Upload tests
245281
uses: actions/upload-artifact@v4
246282
with:
247-
name: tests-webrtc
283+
name: tests-webrtc-${{ matrix.os }}
248284
path: target/release/tests
249285

250286
p2p-scenario-tests:
251287
needs: [ build-tests, build-tests-webrtc ]
252-
runs-on: ubuntu-22.04
288+
runs-on: ubuntu-latest
253289
container:
254290
image: gcr.io/o1labs-192920/mina-daemon:3.2.0-alpha1-7f94ae0-bullseye-devnet
255291
options: --volume debugger_data:/tmp/db
@@ -312,7 +348,7 @@ jobs:
312348
needs:
313349
- build-tests
314350
- build-tests-webrtc
315-
runs-on: ubuntu-22.04
351+
runs-on: ubuntu-latest
316352
container:
317353
image: gcr.io/o1labs-192920/mina-daemon:3.2.0-alpha1-7f94ae0-bullseye-devnet
318354
options: --volume debugger_data:/tmp/db
@@ -398,7 +434,7 @@ jobs:
398434
needs:
399435
- build-tests
400436
- build-tests-webrtc
401-
runs-on: ubuntu-22.04
437+
runs-on: ubuntu-latest
402438
container:
403439
image: gcr.io/o1labs-192920/mina-daemon:3.2.0-alpha1-7f94ae0-bullseye-devnet
404440
env:
@@ -435,7 +471,7 @@ jobs:
435471
436472
bootstrap-test:
437473
needs: [ build, build-tests ]
438-
runs-on: ubuntu-22.04
474+
runs-on: ubuntu-latest
439475
env:
440476
OPENMINA_HOME: data
441477
BPF_ALIAS: /coda/0.0.1/29936104443aaf264a7f0192ac64b1c7173198c1ed404c1bcff5e562e05eb7f6-0.0.0.0

0 commit comments

Comments
 (0)