chore: make clippy happy (#1849) #5587
This file contains 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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: test ${{ matrix.os }} ${{ matrix.rust }} ${{ matrix.flags }} | |
timeout-minutes: 30 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "windows-latest"] | |
rust: | |
- "stable" | |
- "nightly" | |
- "1.81" # MSRV | |
flags: | |
# No features | |
- "--no-default-features" | |
# Default features | |
- "" | |
# All features | |
- "--all-features" | |
exclude: | |
# All features on MSRV | |
- rust: "1.81" # MSRV | |
flags: "--all-features" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Install Anvil | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Install test binaries | |
shell: bash | |
run: ./.github/scripts/install_test_binaries.sh | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
# Only run tests on latest stable and above | |
- name: Install cargo-nextest | |
if: ${{ matrix.rust != '1.81' }} # MSRV | |
uses: taiki-e/install-action@nextest | |
- name: build | |
if: ${{ matrix.rust == '1.81' }} # MSRV | |
run: cargo build --workspace ${{ matrix.flags }} | |
- name: test | |
shell: bash | |
if: ${{ matrix.rust != '1.81' }} # MSRV | |
run: cargo nextest run --workspace ${{ matrix.flags }} | |
doctest: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- run: cargo test --workspace --doc | |
- run: cargo test --all-features --workspace --doc | |
wasm-unknown: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: wasm32-unknown-unknown | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: cargo hack | |
run: | | |
cargo hack build --workspace --ignore-unknown-features --features ws --target wasm32-unknown-unknown \ | |
--exclude alloy-contract \ | |
--exclude alloy-network \ | |
--exclude alloy-node-bindings \ | |
--exclude alloy-provider \ | |
--exclude alloy-signer \ | |
--exclude alloy-signer-aws \ | |
--exclude alloy-signer-gcp \ | |
--exclude alloy-signer-ledger \ | |
--exclude alloy-signer-local \ | |
--exclude alloy-signer-trezor \ | |
--exclude alloy-transport-ipc | |
wasm-wasi: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: wasm32-wasip1 | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: pin cc # https://github.com/rust-lang/cc-rs/issues/1109 | |
run: cargo update cc --precise 1.0.99 | |
- name: cargo hack | |
run: | | |
cargo hack build --workspace --target wasm32-wasip1 \ | |
--exclude alloy-signer-gcp \ | |
--exclude alloy-signer-ledger \ | |
--exclude alloy-signer-trezor \ | |
--exclude alloy-transport-ipc | |
# Ledger signer requires one of `browser` or `node` features. | |
- name: build ledger | |
run: cargo build -p alloy-signer-ledger --features browser --target wasm32-wasip1 | |
feature-checks: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: cargo hack | |
run: cargo hack check --feature-powerset --depth 1 | |
check-no-std: | |
name: check no_std ${{ matrix.features }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: riscv32imac-unknown-none-elf | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- run: ./scripts/check_no_std.sh | |
clippy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- run: cargo +stable clippy --workspace --all-targets --all-features | |
env: | |
RUSTFLAGS: -Dwarnings | |
docs: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Build documentation | |
run: cargo doc --workspace --all-features --no-deps --document-private-items | |
env: | |
RUSTDOCFLAGS: --cfg docsrs -D warnings --show-type-layout --generate-link-to-definition -Zunstable-options | |
fmt: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all --check | |
deny: | |
uses: ithacaxyz/ci/.github/workflows/deny.yml@main | |
ci-success: | |
name: ci success | |
runs-on: ubuntu-latest | |
if: always() | |
needs: | |
- test | |
- doctest | |
- wasm-unknown | |
- wasm-wasi | |
- feature-checks | |
- check-no-std | |
- clippy | |
- docs | |
- fmt | |
- deny | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |