Fix: Publish CLI WF release #4187
Workflow file for this run
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: Rust Workspace CI | |
| on: | |
| # Mandatory checks - must run on all PRs | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] # the first 3 are the defaults if you dont specify `types` | |
| # Run on main pushes only AFTER publish-images workflow completes successfully | |
| workflow_run: | |
| workflows: ["Publish Service Images"] # Run on `main` pushes only AFTER `publish-images` workflow completes successfully | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Make sure CI fails on all warnings, including Clippy lints | |
| RUSTFLAGS: "-Dwarnings" | |
| # Use a shared cache key for all jobs in the same PR/run. Note the usage of `../Cargo.lock` in invocations | |
| # below to check for any changed deps | |
| CACHE_KEY: "ci-${{ github.head_ref || github.ref_name }}" | |
| # Rust version for consistency across jobs | |
| RUST_VERSION: "1.88.0" | |
| jobs: | |
| taplo: | |
| if: github.event.pull_request.draft == false | |
| name: Cargo.toml format validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Install taplo using cargo | |
| - name: Install Taplo | |
| uses: clechasseur/rs-cargo@v2 | |
| with: | |
| command: install | |
| args: taplo-cli@0.9.0 | |
| # Run Taplo validation on all Cargo.toml files in the workspace | |
| - name: Validate Cargo.toml files | |
| run: taplo lint "**/Cargo.toml" --verbose | |
| # Check Cargo.toml formatting | |
| - name: Check Cargo.toml formatting. Remove `--check` from command to apply changes | |
| run: taplo fmt --check "**/Cargo.toml" --verbose | |
| machete: | |
| if: github.event.pull_request.draft == false | |
| name: Machete | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install cargo-machete | |
| uses: clechasseur/rs-cargo@v2 | |
| with: | |
| command: install | |
| args: cargo-machete@0.7.0 | |
| - name: Machete | |
| uses: clechasseur/rs-cargo@v2 | |
| with: | |
| command: machete | |
| # args are specified one by one to avoid issues with git submodules (particularly inside synd-withdrawals) | |
| args: | | |
| "Cargo.toml" | |
| "shared" | |
| "synd-batch-sequencer" | |
| "synd-maestro" | |
| "synd-mchain" | |
| "synd-translator" | |
| "synd-withdrawals/synd-tee-attestation-zk-proofs/aws-nitro" | |
| "synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program" | |
| "test-framework" | |
| fmt: | |
| if: github.event.pull_request.draft == false | |
| name: Fmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain and rustfmt | |
| run: | | |
| rustup toolchain install nightly --profile minimal | |
| rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt | |
| - name: Run Fmt | |
| run: cargo +nightly fmt --all --check -- --unstable-features | |
| clippy: | |
| if: github.event.pull_request.draft == false | |
| name: Clippy | |
| runs-on: shared-large-01 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| components: "cargo, rustc, clippy, llvm-tools, rustc-dev" | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/Cargo.toml') }} | |
| save-if: "false" # skip saving this cache, only save the one in `tests` | |
| - name: Install SP1 toolchain with retry | |
| run: | | |
| set -e | |
| for i in {1..3}; do | |
| echo "Attempt $i to install SP1 toolchain..." | |
| { | |
| curl -L https://sp1up.succinct.xyz | bash && | |
| ~/.sp1/bin/sp1up && | |
| ~/.sp1/bin/cargo-prove prove --version | |
| } && break || { | |
| echo "Attempt $i failed. Retrying in 5 seconds..." | |
| sleep 5 | |
| } | |
| done | |
| - name: Build SP1 ELF program | |
| run: | | |
| cd synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program | |
| ~/.sp1/bin/cargo-prove prove build | |
| # Run Clippy checks on entire workspace | |
| - name: Run Clippy | |
| run: cargo clippy --workspace --all-targets --all-features | |
| test: | |
| if: github.event.pull_request.draft == false | |
| name: Tests | |
| runs-on: shared-large-02 | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| components: "cargo, rustc, clippy, llvm-tools, rustc-dev" | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/Cargo.toml') }} | |
| save-if: "true" # do save this one | |
| # Install Foundry (required for Anvil, a local Ethereum node simulator) | |
| # Anvil is a critical dependency for tests | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: stable | |
| - name: Install SP1 toolchain | |
| run: | | |
| curl -L https://sp1.succinct.xyz | bash | |
| $HOME/.sp1/bin/sp1up | |
| $HOME/.sp1/bin/cargo-prove prove --version | |
| - name: Build SP1 ELF program | |
| run: | | |
| cd synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program | |
| $HOME/.sp1/bin/cargo-prove prove build | |
| - name: Pre-download docker test docker images | |
| run: | | |
| docker pull ghcr.io/syndicateprotocol/generate_batch | |
| docker pull valkey/valkey:latest | |
| - name: Install nextest | |
| uses: taiki-e/install-action@nextest | |
| - name: Run all tests with nextest (excluding e2e withdrawals and migration) | |
| run: | | |
| # sets debug logs for all syndicate services and info for everything else | |
| RUST_LOG="common=debug,shared=debug,synd_batch_sequencer=debug,synd_block_builder=debug,synd_chain_ingestor=debug,synd_maestro=debug,synd_mchain=debug,synd_slotter=debug,synd_tee_attestation_zk_proofs_aws_nitro=debug,synd_tee_attestation_zk_proofs_sp1_script=debug,synd_tee_attestation_zk_proofs_submitter=debug,synd_translator=debug,test_framework=debug,test_utils=debug,info" \ | |
| RUST_LOG_DISABLE_JSON="true" \ | |
| RUST_LOG_DISABLE_TELEMETRY="true" \ | |
| cargo build && cargo nextest run --workspace --fail-fast -E 'not test(e2e_tee_withdrawal) and not test(e2e_migration)' | |
| # Needs to be the last job step | |
| - name: Notify Slack on Failure | |
| # Only notify for workflow_run failures on main branch (not PRs) | |
| if: failure() && github.event_name == 'workflow_run' && github.ref_name == 'main' | |
| uses: rtCamp/action-slack-notify@v2 | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| SLACK_COLOR: "danger" | |
| SLACK_MESSAGE: ":x: `${{github.workflow}}` failed on `main` branch. View failure information here: <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow>" | |
| SLACK_TITLE: "*${{github.workflow}}* failed on `main` branch. Notify the author of the latest PR merged to `main`" |