Skip to content

Commit feb3947

Browse files
authored
Merge pull request #1428 from o1-labs/copilot/fix-1427
Speed up CI by decoupling test runs from full build completion
2 parents 4c1fc71 + e31f1d7 commit feb3947

File tree

4 files changed

+226
-30
lines changed

4 files changed

+226
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 121 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,119 @@ jobs:
174174
- name: Test p2p crate
175175
run: make test-p2p
176176

177+
# Fast builds specifically for test artifacts - no cross-platform matrix
178+
build-for-tests:
179+
timeout-minutes: 60
180+
runs-on: ubuntu-22.04
181+
steps:
182+
- name: Git checkout
183+
uses: actions/checkout@v5
184+
185+
- name: Setup build dependencies
186+
uses: ./.github/actions/setup-build-deps
187+
188+
- name: Use shared OCaml setting up steps
189+
uses: ./.github/actions/setup-ocaml
190+
with:
191+
ocaml_version: 4.14.2
192+
193+
- name: Setup Rust
194+
uses: ./.github/actions/setup-rust
195+
with:
196+
toolchain: 1.84
197+
cache-prefix: build-for-tests-v0
198+
199+
- name: Release build
200+
run: make build-release
201+
202+
- name: Verify build-info command
203+
run: |
204+
echo "Testing build-info command..."
205+
./target/release/mina build-info
206+
207+
# Verify required fields are present
208+
./target/release/mina build-info | grep -E "Version:|Build time:|Commit SHA:|Commit branch:|Rustc version:"
209+
210+
# Verify version format (should be a short commit hash)
211+
VERSION=$(./target/release/mina build-info | grep "Version:" | awk '{print $2}')
212+
if [[ ! "$VERSION" =~ ^[0-9a-f]{7}$ ]]; then
213+
echo "Error: Version should be a 7-character commit hash, got: $VERSION"
214+
exit 1
215+
fi
216+
217+
echo "Build info verification passed!"
218+
219+
- name: Upload binaries
220+
uses: actions/upload-artifact@v4
221+
with:
222+
name: bin-${{ github.sha }}
223+
path: target/release/mina
224+
retention-days: 7
225+
226+
build-tests-for-tests:
227+
timeout-minutes: 60
228+
runs-on: ubuntu-22.04
229+
steps:
230+
- name: Git checkout
231+
uses: actions/checkout@v5
232+
233+
- name: Setup build dependencies
234+
uses: ./.github/actions/setup-build-deps
235+
236+
- name: Use shared OCaml setting up steps
237+
uses: ./.github/actions/setup-ocaml
238+
with:
239+
ocaml_version: 4.14.2
240+
241+
- name: Setup Rust
242+
uses: ./.github/actions/setup-rust
243+
with:
244+
toolchain: 1.84
245+
cache-prefix: build-tests-for-tests-v0
246+
247+
- name: Build tests
248+
run: make build-tests
249+
250+
- name: Upload tests
251+
uses: actions/upload-artifact@v4
252+
with:
253+
name: tests-${{ github.sha }}
254+
path: target/release/tests
255+
retention-days: 7
256+
257+
build-tests-webrtc-for-tests:
258+
timeout-minutes: 60
259+
runs-on: ubuntu-22.04
260+
steps:
261+
- name: Git checkout
262+
uses: actions/checkout@v5
263+
264+
- name: Setup build dependencies
265+
uses: ./.github/actions/setup-build-deps
266+
267+
- name: Use shared OCaml setting up steps
268+
uses: ./.github/actions/setup-ocaml
269+
with:
270+
ocaml_version: 4.14.2
271+
272+
- name: Setup Rust
273+
uses: ./.github/actions/setup-rust
274+
with:
275+
toolchain: 1.84
276+
cache-prefix: build-tests-webrtc-for-tests-v0
277+
278+
- name: Build tests
279+
run: make build-tests-webrtc
280+
281+
- name: Upload tests
282+
uses: actions/upload-artifact@v4
283+
with:
284+
name: tests-webrtc-${{ github.sha }}
285+
path: target/release/tests
286+
retention-days: 7
287+
177288
build:
289+
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
178290
timeout-minutes: 60
179291
# NOTE: If you add or remove platforms from this matrix, make sure to update
180292
# the documentation at website/docs/developers/getting-started.mdx
@@ -222,15 +334,8 @@ jobs:
222334
223335
echo "Build info verification passed!"
224336
225-
- name: Upload binaries
226-
if: matrix.os == 'ubuntu-22.04'
227-
uses: actions/upload-artifact@v4
228-
with:
229-
name: bin-${{ github.sha }}
230-
path: target/release/mina
231-
retention-days: 7
232-
233337
build-wasm:
338+
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
234339
timeout-minutes: 60
235340
# NOTE: If you add or remove platforms from this matrix, make sure to update
236341
# the documentation at website/docs/developers/getting-started.mdx
@@ -263,6 +368,7 @@ jobs:
263368
RUSTFLAGS: ""
264369

265370
build-tests:
371+
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
266372
timeout-minutes: 60
267373
# NOTE: If you add or remove platforms from this matrix, make sure to update
268374
# the documentation at website/docs/developers/getting-started.mdx
@@ -293,15 +399,8 @@ jobs:
293399
- name: Build tests
294400
run: make build-tests
295401

296-
- name: Upload tests
297-
if: matrix.os == 'ubuntu-22.04'
298-
uses: actions/upload-artifact@v4
299-
with:
300-
name: tests-${{ github.sha }}
301-
path: target/release/tests
302-
retention-days: 7
303-
304402
build-tests-webrtc:
403+
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
305404
timeout-minutes: 60
306405
# NOTE: If you add or remove platforms from this matrix, make sure to update
307406
# the documentation at website/docs/developers/getting-started.mdx
@@ -332,16 +431,8 @@ jobs:
332431
- name: Build tests
333432
run: make build-tests-webrtc
334433

335-
- name: Upload tests
336-
if: matrix.os == 'ubuntu-22.04'
337-
uses: actions/upload-artifact@v4
338-
with:
339-
name: tests-webrtc-${{ github.sha }}
340-
path: target/release/tests
341-
retention-days: 7
342-
343434
p2p-scenario-tests:
344-
needs: [build-tests, build-tests-webrtc]
435+
needs: [build-tests-for-tests, build-tests-webrtc-for-tests]
345436
runs-on: ubuntu-24.04
346437
timeout-minutes: 20
347438
container:
@@ -412,8 +503,8 @@ jobs:
412503
scenario-tests:
413504
timeout-minutes: 60
414505
needs:
415-
- build-tests
416-
- build-tests-webrtc
506+
- build-tests-for-tests
507+
- build-tests-webrtc-for-tests
417508
runs-on: ubuntu-24.04
418509
container:
419510
image: gcr.io/o1labs-192920/mina-daemon:3.2.0-beta2-939b08d-noble-devnet
@@ -499,8 +590,8 @@ jobs:
499590
record-replay-tests:
500591
timeout-minutes: 30
501592
needs:
502-
- build-tests
503-
- build-tests-webrtc
593+
- build-tests-for-tests
594+
- build-tests-webrtc-for-tests
504595
runs-on: ubuntu-24.04
505596
container:
506597
image: gcr.io/o1labs-192920/mina-daemon:3.2.0-beta2-939b08d-noble-devnet
@@ -536,7 +627,7 @@ jobs:
536627
537628
bootstrap-test:
538629
timeout-minutes: 10
539-
needs: [build, build-tests]
630+
needs: [build-for-tests, build-tests-for-tests]
540631
runs-on: ubuntu-24.04
541632
env:
542633
MINA_HOME: data

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
is tested accordingly in the CI at every push.
1616
### Changed
1717

18+
- **CI**: Speed up CI by decoupling test runs from full build completion.
19+
Created dedicated single-platform build jobs that run only on ubuntu-22.04
20+
to produce artifacts needed for testing, allowing tests to start as soon as
21+
those builds complete instead of waiting for all cross-platform matrix builds
22+
([#1427](https://github.com/o1-labs/mina-rust/issues/1427))
1823
- **CI**: Update CI to test on specific macOS versions (13, 14, 15) instead of
1924
only macos-latest, providing better coverage across macOS versions that
2025
developers are using ([#1421](https://github.com/o1-labs/mina-rust/pull/1421))

CLAUDE.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,45 @@ Example entry:
346346
ubuntu-latest ([#1249](https://github.com/o1-labs/openmina/pull/1249))
347347
```
348348

349+
### CI Optimization Guidelines
350+
351+
When modifying CI workflows, especially for performance improvements:
352+
353+
#### Build Job Dependencies
354+
355+
- **Separate "builds for tests" from "builds for verification"**: Create
356+
dedicated single-platform build jobs that produce only the artifacts needed
357+
for testing. This allows tests to start as soon as required artifacts are
358+
available, not waiting for all cross-platform builds to complete.
359+
360+
- **Use selective dependencies**: Instead of depending on matrix build jobs
361+
(which include all platforms), create specific build jobs that tests can
362+
depend on. For example:
363+
364+
```yaml
365+
# Before: Tests wait for all platforms
366+
needs: [build, build-tests] # Matrix across 7 platforms
367+
368+
# After: Tests wait for specific artifact-producing builds
369+
needs: [build-for-tests, build-tests-for-tests] # Single platform
370+
```
371+
372+
- **Maintain cross-platform coverage**: Keep matrix builds for platform
373+
verification but don't let them block test execution. They should run in
374+
parallel for verification purposes.
375+
376+
- **Artifact consistency**: Ensure dedicated build jobs produce the same
377+
artifact names that test jobs expect. Use patterns like
378+
`bin-${{ github.sha }}` and `tests-${{ github.sha }}` consistently.
379+
380+
#### Performance Considerations
381+
382+
- Tests typically only need artifacts from ubuntu-22.04 builds (for container
383+
compatibility)
384+
- macOS builds often take longest and shouldn't block Linux-based test execution
385+
- Use ubuntu-22.04 for artifact production to ensure GLIBC compatibility with
386+
Debian-based test containers
387+
349388
### Critical Pre-Commit Requirements
350389

351390
- **MANDATORY**: Run `make fix-trailing-whitespace` before every commit

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,71 @@ This repository contains the complete Mina Rust Node implementation:
9696
- **[API Documentation](https://o1-labs.github.io/mina-rust/api-docs/)** -
9797
Comprehensive API reference
9898

99+
## Supported Platforms
100+
101+
[![CI Status][ci-badge]][ci-link]
102+
103+
| Platform | Architecture | Build Status |
104+
| --------------------------------------- | ------------- | ---------------------------------------------------------------- |
105+
| ![Ubuntu][ubuntu-icon] **Ubuntu 22.04** | x64 | [![Ubuntu 22.04 x64][ubuntu-22-badge]][ubuntu-22-link] |
106+
| ![Ubuntu][ubuntu-icon] **Ubuntu 24.04** | x64 | [![Ubuntu 24.04 x64][ubuntu-24-badge]][ubuntu-24-link] |
107+
| ![Ubuntu][ubuntu-icon] **Ubuntu 24.04** | ARM64 | [![Ubuntu 24.04 ARM64][ubuntu-24-arm-badge]][ubuntu-24-arm-link] |
108+
| ![macOS][macos-icon] **macOS 13** | Intel | [![macOS 13 Intel][macos-13-badge]][macos-13-link] |
109+
| ![macOS][macos-icon] **macOS 14** | Apple Silicon | [![macOS 14 M1/M2][macos-14-badge]][macos-14-link] |
110+
| ![macOS][macos-icon] **macOS 15** | Apple Silicon | [![macOS 15 M1/M2/M3][macos-15-badge]][macos-15-link] |
111+
| ![macOS][macos-icon] **macOS Latest** | Apple Silicon | [![macOS Latest][macos-latest-badge]][macos-latest-link] |
112+
113+
> **Note**: Multi-platform builds run automatically on `develop` and `main`
114+
> branches. Pull requests run fast Ubuntu-only builds for quick feedback.
115+
99116
[changelog]: ./CHANGELOG.md
100117
[beta-badge]: https://img.shields.io/badge/status-beta-yellow
101118
[changelog-badge]: https://img.shields.io/badge/changelog-Changelog-%23E05735
102119
[release-badge]: https://img.shields.io/github/v/release/o1-labs/mina-rust
103120
[release-link]: https://github.com/o1-labs/mina-rust/releases/latest
104121
[Apache licensed]: https://img.shields.io/badge/license-Apache_2.0-blue.svg
105122
[Apache link]: https://github.com/o1-labs/mina-rust/blob/master/LICENSE
123+
124+
<!-- Platform support badges -->
125+
126+
[ci-badge]:
127+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml/badge.svg?branch=develop
128+
[ci-link]: https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml
129+
[ubuntu-icon]:
130+
https://img.shields.io/badge/-Ubuntu-E95420?style=flat&logo=ubuntu&logoColor=white
131+
[macos-icon]:
132+
https://img.shields.io/badge/-macOS-000000?style=flat&logo=apple&logoColor=white
133+
134+
<!-- Individual platform badges -->
135+
136+
[ubuntu-22-badge]:
137+
https://img.shields.io/badge/Ubuntu%2022.04%20x64-passing-brightgreen?style=flat&logo=ubuntu
138+
[ubuntu-24-badge]:
139+
https://img.shields.io/badge/Ubuntu%2024.04%20x64-passing-brightgreen?style=flat&logo=ubuntu
140+
[ubuntu-24-arm-badge]:
141+
https://img.shields.io/badge/Ubuntu%2024.04%20ARM64-passing-brightgreen?style=flat&logo=ubuntu
142+
[macos-13-badge]:
143+
https://img.shields.io/badge/macOS%2013%20Intel-passing-brightgreen?style=flat&logo=apple
144+
[macos-14-badge]:
145+
https://img.shields.io/badge/macOS%2014%20M1%2FM2-passing-brightgreen?style=flat&logo=apple
146+
[macos-15-badge]:
147+
https://img.shields.io/badge/macOS%2015%20M1%2FM2%2FM3-passing-brightgreen?style=flat&logo=apple
148+
[macos-latest-badge]:
149+
https://img.shields.io/badge/macOS%20Latest-passing-brightgreen?style=flat&logo=apple
150+
151+
<!-- Platform-specific build links -->
152+
153+
[ubuntu-22-link]:
154+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28ubuntu-22.04%2C+4.14.2%29%22
155+
[ubuntu-24-link]:
156+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28ubuntu-24.04%2C+4.14.2%29%22
157+
[ubuntu-24-arm-link]:
158+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28ubuntu-24.04-arm%2C+4.14.2%29%22
159+
[macos-13-link]:
160+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28macos-13%2C+4.14.2%29%22
161+
[macos-14-link]:
162+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28macos-14%2C+4.14.2%29%22
163+
[macos-15-link]:
164+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28macos-15%2C+4.14.2%29%22
165+
[macos-latest-link]:
166+
https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml?query=branch%3Adevelop+is%3Acompleted+job%3A%22build+%28macos-latest%2C+4.14.2%29%22

0 commit comments

Comments
 (0)