chore: improve linting #304
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 Checks | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check-scripts: | |
name: Check bash scripts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download and Extract Fixtures | |
run: | | |
chmod +x ./scripts/download-and-extract-fixtures.sh | |
./scripts/download-and-extract-fixtures.sh v5.1.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
check-precompile-patches: | |
name: Check ${{ matrix.zkVM }} unused precompile patches | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- zkVM: reth-sp1-stateless-validator | |
xtask: sp1 | |
- zkVM: reth-risc0-stateless-validator | |
xtask: risc0 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ere-guests | |
- name: Check for unused [patch] entries | |
shell: bash | |
run: | | |
set -euo pipefail | |
cargo ${{ matrix.xtask }} | |
cd ere-guests | |
if cargo tree -p ${{ matrix.zkVM }} 2>&1 | grep -F "was not used in the crate graph"; then | |
exit 1 | |
fi | |
lint-and-test: | |
name: Lint and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy, rustfmt | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
run: cargo fmt --check --all | |
- name: Check clippy | |
run: cargo clippy --workspace --bins --lib --examples --tests --benches --all-features -- -D warnings | |
- name: Run all tests except integration tests | |
env: | |
RPC_URL: ${{ secrets.RPC_URL }} | |
RPC_HEADERS: ${{ secrets.RPC_HEADERS }} | |
run: cargo test --workspace --exclude tests -- --no-capture |