From 6db70c6701ce80329cafe267d6a949ea24ce8264 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 12 Aug 2026 11:21:27 +0200 Subject: [PATCH] ci: add Rust quality checks ## What changed Add independent pull-request workflows for formatting, Clippy, and nextest. Configure Rust and Solana toolchains plus cached Cargo and Solana build artifacts. Closes #39 ## Impact Pull requests containing these workflows report all three standard Rust checks independently. The change affects CI only. ## Validation - Parsed all three workflow files as YAML. - `cargo fmt --check` passed on the complete `replicator` stack. - `git diff --check` passed. - Clippy reached the existing Keeper SBF build locally; the installed Solana 3.0.11 platform toolchain is too old for edition 2024. CI installs Solana 4.0.3. - Nextest is installed and exercised by the CI workflow. ## Reviewer notes This branch is stacked on `replicator`, the first point where the complete engine workspace exists. Existing stack branches remain unchanged. --- .github/workflows/ci-fmt.yml | 28 +++++++++++++++++ .github/workflows/ci-lint.yml | 54 +++++++++++++++++++++++++++++++++ .github/workflows/ci-test.yml | 57 +++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 .github/workflows/ci-fmt.yml create mode 100644 .github/workflows/ci-lint.yml create mode 100644 .github/workflows/ci-test.yml diff --git a/.github/workflows/ci-fmt.yml b/.github/workflows/ci-fmt.yml new file mode 100644 index 00000000..8e7afa3f --- /dev/null +++ b/.github/workflows/ci-fmt.yml @@ -0,0 +1,28 @@ +name: Run CI - Format + +on: + push: + branches: [master, dev] + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + format: + name: Format + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Install Rust toolchain + run: rustup toolchain install 1.96.1 --profile minimal --component rustfmt + + - name: Check formatting + run: cargo fmt --check diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml new file mode 100644 index 00000000..d2ed47fb --- /dev/null +++ b/.github/workflows/ci-lint.yml @@ -0,0 +1,54 @@ +name: Run CI - Lint + +on: + push: + branches: [master, dev] + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Install Rust toolchain + run: rustup toolchain install 1.96.1 --profile minimal --component clippy + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + shared-key: magicblock-engine-ci-lint-v001 + cache-on-failure: true + + - name: Cache Solana CLI + id: cache-solana + uses: actions/cache@v4 + with: + path: ~/.local/share/solana + key: solana-cli-v1-${{ runner.os }}-${{ runner.arch }}-v4.0.3 + + - name: Cache Solana platform tools + uses: actions/cache@v4 + with: + path: ~/.cache/solana + key: solana-platform-tools-v1-${{ runner.os }}-${{ runner.arch }}-v4.0.3 + + - name: Install Solana CLI + if: steps.cache-solana.outputs.cache-hit != 'true' + run: sh -c "$(curl -sSfL https://release.anza.xyz/v4.0.3/install)" + + - name: Add Solana CLI to PATH + run: echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" + + - name: Run Clippy + run: cargo clippy --all-features --all-targets -- -D warnings diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml new file mode 100644 index 00000000..7b8a62d5 --- /dev/null +++ b/.github/workflows/ci-test.yml @@ -0,0 +1,57 @@ +name: Run CI - Tests + +on: + push: + branches: [master, dev] + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Install Rust toolchain + run: rustup toolchain install 1.96.1 --profile minimal + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + shared-key: magicblock-engine-ci-test-v001 + cache-on-failure: true + + - name: Cache Solana CLI + id: cache-solana + uses: actions/cache@v4 + with: + path: ~/.local/share/solana + key: solana-cli-v1-${{ runner.os }}-${{ runner.arch }}-v4.0.3 + + - name: Cache Solana platform tools + uses: actions/cache@v4 + with: + path: ~/.cache/solana + key: solana-platform-tools-v1-${{ runner.os }}-${{ runner.arch }}-v4.0.3 + + - name: Install Solana CLI + if: steps.cache-solana.outputs.cache-hit != 'true' + run: sh -c "$(curl -sSfL https://release.anza.xyz/v4.0.3/install)" + + - name: Add Solana CLI to PATH + run: echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" + + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + + - name: Run tests + run: cargo nextest run --nff