Consolidate build workflows #427
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| refresh_cache: | |
| description: "Refresh cargo cache" | |
| required: false | |
| type: boolean | |
| default: false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: full | |
| MINA_PANIC_ON_BUG: true | |
| CARGO_INCREMENTAL: 1 | |
| RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off" | |
| RUST_STABLE_VERSION: "1.84" | |
| RUST_NIGHTLY_VERSION: "nightly" | |
| OCAML_VERSION: "4.14.2" | |
| CACHE_VERSION: "v0" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| refresh-cache: | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.refresh_cache == 'true' }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| enable-cache: false | |
| - name: Clean cargo cache | |
| run: cargo clean | |
| ledger-tests: | |
| timeout-minutes: 20 | |
| runs-on: ubuntu-24.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: ${{ env.OCAML_VERSION }} | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_NIGHTLY_VERSION }} | |
| cache-prefix: ledger-${{ env.CACHE_VERSION }} | |
| - name: Download circuits files | |
| uses: ./.github/actions/setup-circuits | |
| - name: Build ledger tests | |
| run: make build-ledger | |
| - name: Run ledger tests | |
| run: make test-ledger | |
| mina-node-native-tests: | |
| timeout-minutes: 30 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup build dependencies | |
| uses: ./.github/actions/setup-build-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| cache-prefix: mina-node-native-${{ env.CACHE_VERSION }} | |
| - name: Test mina-node-native crate | |
| run: make test-node-native | |
| p2p-messages-tests: | |
| timeout-minutes: 20 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup build dependencies | |
| uses: ./.github/actions/setup-build-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_NIGHTLY_VERSION }} | |
| cache-prefix: p2p-messages-${{ env.CACHE_VERSION }} | |
| - name: Download circuits files | |
| uses: ./.github/actions/setup-circuits | |
| - name: Run mina-p2p-messages | |
| run: make test-p2p-messages | |
| # TODO: add back when reimplemented | |
| # ledger-32x9-tests: | |
| # runs-on: ubuntu-24.04 | |
| # steps: | |
| # - name: Git checkout | |
| # uses: actions/checkout@v5 | |
| # - name: Setup build dependencies | |
| # uses: ./.github/actions/setup-build-deps | |
| # - name: Setup Rust | |
| # uses: ./.github/actions/setup-rust | |
| # with: | |
| # toolchain: nightly | |
| # cache-prefix: ledger-32x9-v0 | |
| # - name: Download circuits files | |
| # uses: ./.github/actions/setup-circuits | |
| # - name: Enable 32x9 fields implementation | |
| # run: | | |
| # cargo install sd | |
| # sd '^mina-curves.*$' '' ./Cargo.toml | |
| # sd '^ark-ff = \{ version .*$' '' ./Cargo.toml | |
| # sd -F '# UNCOMMENTED_IN_CI ' '' ./Cargo.toml | |
| # cat ./Cargo.toml | |
| # - name: Build ledger tests | |
| # run: make build-ledger | |
| # - name: Run ledger tests | |
| # run: make test-ledger | |
| vrf-tests: | |
| timeout-minutes: 20 | |
| runs-on: ubuntu-24.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: ${{ env.OCAML_VERSION }} | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_NIGHTLY_VERSION }} | |
| cache-prefix: vrf-${{ env.CACHE_VERSION }} | |
| - name: Build vrf tests | |
| run: make build-vrf | |
| - name: Run vrf tests | |
| run: make test-vrf | |
| p2p-tests: | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup build dependencies | |
| uses: ./.github/actions/setup-build-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| cache-prefix: p2p-${{ env.CACHE_VERSION }} | |
| - name: Test p2p crate | |
| run: make test-p2p | |
| # Fast builds specifically for test artifacts - no cross-platform matrix | |
| build: | |
| 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: ${{ env.OCAML_VERSION }} | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| cache-prefix: build-${{ env.CACHE_VERSION }} | |
| - 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 | |
| account-tests: | |
| timeout-minutes: 20 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup build dependencies | |
| uses: ./.github/actions/setup-build-deps | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| cache-prefix: build-${{ env.CACHE_VERSION }} | |
| - name: Run account tests | |
| run: make test-account | |
| wallet-tests: | |
| needs: [build] | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v5 | |
| - name: Download mina binary | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: bin-${{ github.sha }} | |
| - name: Make binary executable | |
| run: chmod +x mina | |
| - name: Create target/release directory | |
| run: mkdir -p target/release | |
| - name: Move binary to expected location | |
| run: mv mina target/release/ | |
| - name: Run wallet tests | |
| env: | |
| MINA_PRIVKEY_PASS: ${{ secrets.MINA_PRIVKEY_PASS }} | |
| MINA_NODE_ENDPOINT: http://mina-rust-plain-1.gcp.o1test.net/graphql | |
| MINA_E2E_TEST_MEMO: MINA_RUST PR#${{ github.event.pull_request.number }} | |
| run: make test-wallet | |
| build-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: ${{ env.OCAML_VERSION }} | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| cache-prefix: build-tests-${{ env.CACHE_VERSION }} | |
| - 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: | |
| 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: ${{ env.OCAML_VERSION }} | |
| - name: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_STABLE_VERSION }} | |
| cache-prefix: build-tests-webrtc-${{ env.CACHE_VERSION }} | |
| - 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-wasm: | |
| 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: Setup Rust | |
| uses: ./.github/actions/setup-rust | |
| with: | |
| toolchain: ${{ env.RUST_NIGHTLY_VERSION }} | |
| cache-prefix: build-wasm-${{ env.CACHE_VERSION }} | |
| - name: Setup wasm tooling | |
| run: make setup-wasm | |
| - name: Build WebAssembly node | |
| run: make build-wasm | |
| p2p-scenario-tests: | |
| needs: [build-tests, build-tests-webrtc] | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| container: | |
| image: gcr.io/o1labs-192920/mina-daemon:3.3.0-alpha1-6929a7e-noble-devnet | |
| options: --volume debugger_data:/tmp/db | |
| env: | |
| BPF_ALIAS: /coda/0.0.1/29936104443aaf264a7f0192ac64b1c7173198c1ed404c1bcff5e562e05eb7f6-0.0.0.0 | |
| strategy: | |
| matrix: | |
| test: | |
| [ | |
| p2p_basic_connections, | |
| p2p_basic_incoming, | |
| p2p_basic_outgoing, | |
| p2p_pubsub, | |
| p2p_kad, | |
| webrtc_p2p_basic_connections, | |
| ] | |
| fail-fast: false | |
| services: | |
| network-debugger: | |
| image: openmina/mina-network-debugger:23385c61 | |
| options: --privileged --init --volume debugger_data:/tmp/db --volume /sys/kernel/debug:/sys/kernel/debug | |
| env: | |
| SERVER_PORT: 80 | |
| FIREWALL_INTERFACE: lo | |
| RUST_LOG: info | |
| DB_PATH: /tmp/db | |
| ports: | |
| - 80:80 | |
| steps: | |
| - name: Install libssl3t64 # Our binaries are built on a newer ubuntu and require libssl3t64 | |
| run: | | |
| apt-get update && \ | |
| apt-get install -y --no-install-recommends libssl3t64 && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| - name: Download tests | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: tests*-${{ github.sha }} | |
| merge-multiple: true | |
| - name: Setup permissions | |
| run: | | |
| chmod +x ./${{ matrix.test }} | |
| # TODO: use curl | |
| - name: Wait for the debugger | |
| run: | | |
| sleep 5 | |
| - name: Run the test | |
| run: | | |
| ./${{ matrix.test }} --test-threads=1 | |
| - name: Archive network debugger database | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: network-debugger-${{ matrix.test }}-${{ github.sha }} | |
| path: /tmp/db | |
| retention-days: 3 | |
| if: ${{ always() }} | |
| scenario-tests: | |
| timeout-minutes: 60 | |
| needs: | |
| - build-tests | |
| - build-tests-webrtc | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: gcr.io/o1labs-192920/mina-daemon:3.3.0-alpha1-6929a7e-noble-devnet | |
| options: --volume debugger_data:/tmp/db | |
| env: | |
| # to allow local addrs discovery | |
| MINA_DISCOVERY_FILTER_ADDR: false | |
| # to allow connection with replayer | |
| # TODO: remove when replayer supports identify | |
| KEEP_CONNECTION_WITH_UNKNOWN_STREAM: true | |
| REPLAYER_MULTIADDR: "/dns4/primary-tcp-proxy.hz.minaprotocol.network/tcp/40110/p2p/12D3KooWPayQEdprqY2m3biReUUybA5LoULpJE7YWu6wetEKKELv" | |
| BPF_ALIAS: /coda/0.0.1/29936104443aaf264a7f0192ac64b1c7173198c1ed404c1bcff5e562e05eb7f6-0.0.0.0 | |
| strategy: | |
| matrix: | |
| test: | |
| - single_node | |
| - multi_node_initial_joining | |
| - multi_node_peer_discovery | |
| - multi_node_propagate_block | |
| - connection_discovery_ocaml_to_rust_via_seed | |
| - connection_discovery_ocaml_to_rust | |
| - connection_discovery_rust_as_seed | |
| - connection_discovery_rust_to_ocaml_via_seed | |
| - connection_discovery_rust_to_ocaml | |
| - webrtc_p2p_signaling | |
| # - webrtc_single_node | |
| # - webrtc_multi_node | |
| fail-fast: false | |
| services: | |
| network-debugger: | |
| image: openmina/mina-network-debugger:23385c61 | |
| options: --privileged --init --volume debugger_data:/tmp/db --volume /sys/kernel/debug:/sys/kernel/debug | |
| env: | |
| SERVER_PORT: 80 | |
| FIREWALL_INTERFACE: lo | |
| RUST_LOG: info | |
| DB_PATH: /tmp/db | |
| ports: | |
| - 80:80 | |
| steps: | |
| - name: Install libssl3t64 # Our binaries are built on a newer ubuntu and require libssl3t64 | |
| run: | | |
| apt-get update && \ | |
| apt-get install -y --no-install-recommends libssl3t64 && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| - name: Download tests | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: tests*-${{ github.sha }} | |
| merge-multiple: true | |
| - name: Download tests | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: tests-webrtc*-${{ github.sha }} | |
| merge-multiple: true | |
| - name: Setup permissions | |
| run: | | |
| chmod +x ./${{ matrix.test }} | |
| # TODO: use curl | |
| - name: Wait for the debugger | |
| run: | | |
| sleep 5 | |
| - name: Run the test | |
| run: | | |
| ./${{ matrix.test }} --test-threads=1 | |
| - name: Archive network debugger database | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: network-debugger-${{ matrix.test }}-${{ github.sha }} | |
| path: /tmp/db | |
| retention-days: 3 | |
| if: ${{ always() }} | |
| record-replay-tests: | |
| timeout-minutes: 30 | |
| needs: | |
| - build-tests | |
| - build-tests-webrtc | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: gcr.io/o1labs-192920/mina-daemon:3.3.0-alpha1-6929a7e-noble-devnet | |
| env: | |
| # to allow local addrs discovery | |
| MINA_DISCOVERY_FILTER_ADDR: false | |
| strategy: | |
| matrix: | |
| test: [record_replay, webrtc_record_replay] | |
| fail-fast: false | |
| steps: | |
| - name: Install libssl3t64 # Our binaries are built on a newer ubuntu and require libssl3t64 | |
| run: | | |
| apt-get update && \ | |
| apt-get install -y --no-install-recommends libssl3t64 && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| - name: Download tests | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: tests*-${{ github.sha }} | |
| merge-multiple: true | |
| - name: Setup permissions | |
| run: | | |
| chmod +x ./${{ matrix.test }} | |
| - name: Run the test | |
| run: | | |
| ./${{ matrix.test }} --test-threads=1 | |
| bootstrap-test: | |
| timeout-minutes: 10 | |
| needs: [build, build-tests] | |
| runs-on: ubuntu-24.04 | |
| env: | |
| MINA_HOME: data | |
| BPF_ALIAS: /coda/0.0.1/29936104443aaf264a7f0192ac64b1c7173198c1ed404c1bcff5e562e05eb7f6-0.0.0.0 | |
| services: | |
| network-debugger: | |
| image: openmina/mina-network-debugger:23385c61 | |
| options: --privileged --init --volume /tmp/db:/tmp/db --volume /sys/kernel/debug:/sys/kernel/debug | |
| env: | |
| SERVER_PORT: 80 | |
| FIREWALL_INTERFACE: lo | |
| RUST_LOG: info | |
| DB_PATH: /tmp/db | |
| ports: | |
| - 80:80 | |
| steps: | |
| - name: Download binary | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: bin-${{ github.sha }} | |
| - name: Download test | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: tests*-${{ github.sha }} | |
| merge-multiple: true | |
| - name: Fix permissions | |
| run: | | |
| chmod +x bootstrap mina | |
| # TODO: use curl | |
| - name: Wait for the debugger | |
| run: | | |
| sleep 5 | |
| - name: Bootstrap node | |
| env: | |
| MINA_COMMAND: mina | |
| NO_PEER_DISCOVERY: "true" | |
| OUT_PATH: ${{ env.MINA_HOME }}/logs/bootstrap_output | |
| RECORD: state-with-input-actions | |
| run: | | |
| mkdir -p $OUT_PATH | |
| PATH=$PATH:$(pwd) MINA_COMMAND=mina NO_PEER_DISCOVERY=true ./bootstrap --nocapture || { | |
| echo "::group::Stderr" | |
| cat $OUT_PATH.stderr | |
| echo "::endgroup::" | |
| exit 1 | |
| } | |
| - name: Upload logs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bootstrap-logs-${{ github.sha }} | |
| path: ${{ env.MINA_HOME }}/logs/* | |
| retention-days: 7 | |
| if: ${{ failure() }} | |
| - name: Upload record | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bootstrap-record-${{ github.sha }} | |
| path: ${{ env.MINA_HOME }}/recorder/* | |
| retention-days: 7 | |
| if: ${{ failure() }} | |
| - name: Archive network debugger database | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: network-debugger-test-bootstrap-${{ github.sha }} | |
| path: /tmp/db | |
| retention-days: 3 | |
| if: ${{ always() }} |