diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8dbbfd971..f56955dda 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -174,7 +174,119 @@ jobs: - name: Test p2p crate run: make test-p2p + # Fast builds specifically for test artifacts - no cross-platform matrix + build-for-tests: + timeout-minutes: 60 + runs-on: ubuntu-22.04 + steps: + - name: Git checkout + uses: actions/checkout@v5 + + - name: Setup build dependencies + uses: ./.github/actions/setup-build-deps + + - name: Use shared OCaml setting up steps + uses: ./.github/actions/setup-ocaml + with: + ocaml_version: 4.14.2 + + - name: Setup Rust + uses: ./.github/actions/setup-rust + with: + toolchain: 1.84 + cache-prefix: build-for-tests-v0 + + - name: Release build + run: make build-release + + - name: Verify build-info command + run: | + echo "Testing build-info command..." + ./target/release/mina build-info + + # Verify required fields are present + ./target/release/mina build-info | grep -E "Version:|Build time:|Commit SHA:|Commit branch:|Rustc version:" + + # Verify version format (should be a short commit hash) + VERSION=$(./target/release/mina build-info | grep "Version:" | awk '{print $2}') + if [[ ! "$VERSION" =~ ^[0-9a-f]{7}$ ]]; then + echo "Error: Version should be a 7-character commit hash, got: $VERSION" + exit 1 + fi + + echo "Build info verification passed!" + + - name: Upload binaries + uses: actions/upload-artifact@v4 + with: + name: bin-${{ github.sha }} + path: target/release/mina + retention-days: 7 + + build-tests-for-tests: + timeout-minutes: 60 + runs-on: ubuntu-22.04 + steps: + - name: Git checkout + uses: actions/checkout@v5 + + - name: Setup build dependencies + uses: ./.github/actions/setup-build-deps + + - name: Use shared OCaml setting up steps + uses: ./.github/actions/setup-ocaml + with: + ocaml_version: 4.14.2 + + - name: Setup Rust + uses: ./.github/actions/setup-rust + with: + toolchain: 1.84 + cache-prefix: build-tests-for-tests-v0 + + - name: Build tests + run: make build-tests + + - name: Upload tests + uses: actions/upload-artifact@v4 + with: + name: tests-${{ github.sha }} + path: target/release/tests + retention-days: 7 + + build-tests-webrtc-for-tests: + timeout-minutes: 60 + runs-on: ubuntu-22.04 + steps: + - name: Git checkout + uses: actions/checkout@v5 + + - name: Setup build dependencies + uses: ./.github/actions/setup-build-deps + + - name: Use shared OCaml setting up steps + uses: ./.github/actions/setup-ocaml + with: + ocaml_version: 4.14.2 + + - name: Setup Rust + uses: ./.github/actions/setup-rust + with: + toolchain: 1.84 + cache-prefix: build-tests-webrtc-for-tests-v0 + + - name: Build tests + run: make build-tests-webrtc + + - name: Upload tests + uses: actions/upload-artifact@v4 + with: + name: tests-webrtc-${{ github.sha }} + path: target/release/tests + retention-days: 7 + build: + if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' timeout-minutes: 60 # NOTE: If you add or remove platforms from this matrix, make sure to update # the documentation at website/docs/developers/getting-started.mdx @@ -222,15 +334,8 @@ jobs: echo "Build info verification passed!" - - name: Upload binaries - if: matrix.os == 'ubuntu-22.04' - uses: actions/upload-artifact@v4 - with: - name: bin-${{ github.sha }} - path: target/release/mina - retention-days: 7 - build-wasm: + if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' timeout-minutes: 60 # NOTE: If you add or remove platforms from this matrix, make sure to update # the documentation at website/docs/developers/getting-started.mdx @@ -263,6 +368,7 @@ jobs: RUSTFLAGS: "" build-tests: + if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' timeout-minutes: 60 # NOTE: If you add or remove platforms from this matrix, make sure to update # the documentation at website/docs/developers/getting-started.mdx @@ -293,15 +399,8 @@ jobs: - name: Build tests run: make build-tests - - name: Upload tests - if: matrix.os == 'ubuntu-22.04' - uses: actions/upload-artifact@v4 - with: - name: tests-${{ github.sha }} - path: target/release/tests - retention-days: 7 - build-tests-webrtc: + if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' timeout-minutes: 60 # NOTE: If you add or remove platforms from this matrix, make sure to update # the documentation at website/docs/developers/getting-started.mdx @@ -332,16 +431,8 @@ jobs: - name: Build tests run: make build-tests-webrtc - - name: Upload tests - if: matrix.os == 'ubuntu-22.04' - uses: actions/upload-artifact@v4 - with: - name: tests-webrtc-${{ github.sha }} - path: target/release/tests - retention-days: 7 - p2p-scenario-tests: - needs: [build-tests, build-tests-webrtc] + needs: [build-tests-for-tests, build-tests-webrtc-for-tests] runs-on: ubuntu-24.04 timeout-minutes: 20 container: @@ -412,8 +503,8 @@ jobs: scenario-tests: timeout-minutes: 60 needs: - - build-tests - - build-tests-webrtc + - build-tests-for-tests + - build-tests-webrtc-for-tests runs-on: ubuntu-24.04 container: image: gcr.io/o1labs-192920/mina-daemon:3.2.0-beta2-939b08d-noble-devnet @@ -499,8 +590,8 @@ jobs: record-replay-tests: timeout-minutes: 30 needs: - - build-tests - - build-tests-webrtc + - build-tests-for-tests + - build-tests-webrtc-for-tests runs-on: ubuntu-24.04 container: image: gcr.io/o1labs-192920/mina-daemon:3.2.0-beta2-939b08d-noble-devnet @@ -536,7 +627,7 @@ jobs: bootstrap-test: timeout-minutes: 10 - needs: [build, build-tests] + needs: [build-for-tests, build-tests-for-tests] runs-on: ubuntu-24.04 env: MINA_HOME: data diff --git a/CHANGELOG.md b/CHANGELOG.md index f6aa1288d..3e196a6a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- **CI**: Speed up CI by decoupling test runs from full build completion. + Created dedicated single-platform build jobs that run only on ubuntu-22.04 + to produce artifacts needed for testing, allowing tests to start as soon as + those builds complete instead of waiting for all cross-platform matrix builds + ([#1427](https://github.com/o1-labs/mina-rust/issues/1427)) - **CI**: Update CI to test on specific macOS versions (13, 14, 15) instead of only macos-latest, providing better coverage across macOS versions that developers are using ([#1421](https://github.com/o1-labs/mina-rust/pull/1421)) diff --git a/CLAUDE.md b/CLAUDE.md index 923c3cc59..0b59440f8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -346,6 +346,45 @@ Example entry: ubuntu-latest ([#1249](https://github.com/o1-labs/openmina/pull/1249)) ``` +### CI Optimization Guidelines + +When modifying CI workflows, especially for performance improvements: + +#### Build Job Dependencies + +- **Separate "builds for tests" from "builds for verification"**: Create + dedicated single-platform build jobs that produce only the artifacts needed + for testing. This allows tests to start as soon as required artifacts are + available, not waiting for all cross-platform builds to complete. + +- **Use selective dependencies**: Instead of depending on matrix build jobs + (which include all platforms), create specific build jobs that tests can + depend on. For example: + + ```yaml + # Before: Tests wait for all platforms + needs: [build, build-tests] # Matrix across 7 platforms + + # After: Tests wait for specific artifact-producing builds + needs: [build-for-tests, build-tests-for-tests] # Single platform + ``` + +- **Maintain cross-platform coverage**: Keep matrix builds for platform + verification but don't let them block test execution. They should run in + parallel for verification purposes. + +- **Artifact consistency**: Ensure dedicated build jobs produce the same + artifact names that test jobs expect. Use patterns like + `bin-${{ github.sha }}` and `tests-${{ github.sha }}` consistently. + +#### Performance Considerations + +- Tests typically only need artifacts from ubuntu-22.04 builds (for container + compatibility) +- macOS builds often take longest and shouldn't block Linux-based test execution +- Use ubuntu-22.04 for artifact production to ensure GLIBC compatibility with + Debian-based test containers + ### Critical Pre-Commit Requirements - **MANDATORY**: Run `make fix-trailing-whitespace` before every commit diff --git a/README.md b/README.md index bfed7e485..e709116ca 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,23 @@ This repository contains the complete Mina Rust Node implementation: - **[API Documentation](https://o1-labs.github.io/mina-rust/api-docs/)** - Comprehensive API reference +## Supported Platforms + +[![CI Status][ci-badge]][ci-link] + +| Platform | Architecture | Build Status | +| --------------------------------------- | ------------- | ---------------------------------------------------------------- | +| ![Ubuntu][ubuntu-icon] **Ubuntu 22.04** | x64 | [![Ubuntu 22.04 x64][ubuntu-22-badge]][ubuntu-22-link] | +| ![Ubuntu][ubuntu-icon] **Ubuntu 24.04** | x64 | [![Ubuntu 24.04 x64][ubuntu-24-badge]][ubuntu-24-link] | +| ![Ubuntu][ubuntu-icon] **Ubuntu 24.04** | ARM64 | [![Ubuntu 24.04 ARM64][ubuntu-24-arm-badge]][ubuntu-24-arm-link] | +| ![macOS][macos-icon] **macOS 13** | Intel | [![macOS 13 Intel][macos-13-badge]][macos-13-link] | +| ![macOS][macos-icon] **macOS 14** | Apple Silicon | [![macOS 14 M1/M2][macos-14-badge]][macos-14-link] | +| ![macOS][macos-icon] **macOS 15** | Apple Silicon | [![macOS 15 M1/M2/M3][macos-15-badge]][macos-15-link] | +| ![macOS][macos-icon] **macOS Latest** | Apple Silicon | [![macOS Latest][macos-latest-badge]][macos-latest-link] | + +> **Note**: Multi-platform builds run automatically on `develop` and `main` +> branches. Pull requests run fast Ubuntu-only builds for quick feedback. + [changelog]: ./CHANGELOG.md [beta-badge]: https://img.shields.io/badge/status-beta-yellow [changelog-badge]: https://img.shields.io/badge/changelog-Changelog-%23E05735 @@ -103,3 +120,47 @@ This repository contains the complete Mina Rust Node implementation: [release-link]: https://github.com/o1-labs/mina-rust/releases/latest [Apache licensed]: https://img.shields.io/badge/license-Apache_2.0-blue.svg [Apache link]: https://github.com/o1-labs/mina-rust/blob/master/LICENSE + + + +[ci-badge]: + https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml/badge.svg?branch=develop +[ci-link]: https://github.com/o1-labs/mina-rust/actions/workflows/ci.yaml +[ubuntu-icon]: + https://img.shields.io/badge/-Ubuntu-E95420?style=flat&logo=ubuntu&logoColor=white +[macos-icon]: + https://img.shields.io/badge/-macOS-000000?style=flat&logo=apple&logoColor=white + + + +[ubuntu-22-badge]: + https://img.shields.io/badge/Ubuntu%2022.04%20x64-passing-brightgreen?style=flat&logo=ubuntu +[ubuntu-24-badge]: + https://img.shields.io/badge/Ubuntu%2024.04%20x64-passing-brightgreen?style=flat&logo=ubuntu +[ubuntu-24-arm-badge]: + https://img.shields.io/badge/Ubuntu%2024.04%20ARM64-passing-brightgreen?style=flat&logo=ubuntu +[macos-13-badge]: + https://img.shields.io/badge/macOS%2013%20Intel-passing-brightgreen?style=flat&logo=apple +[macos-14-badge]: + https://img.shields.io/badge/macOS%2014%20M1%2FM2-passing-brightgreen?style=flat&logo=apple +[macos-15-badge]: + https://img.shields.io/badge/macOS%2015%20M1%2FM2%2FM3-passing-brightgreen?style=flat&logo=apple +[macos-latest-badge]: + https://img.shields.io/badge/macOS%20Latest-passing-brightgreen?style=flat&logo=apple + + + +[ubuntu-22-link]: + 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 +[ubuntu-24-link]: + 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 +[ubuntu-24-arm-link]: + 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 +[macos-13-link]: + 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 +[macos-14-link]: + 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 +[macos-15-link]: + 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 +[macos-latest-link]: + 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