name: Lint on: push: branches: - develop pull_request: workflow_dispatch: jobs: clippy: strategy: matrix: os: [ubuntu-latest, macos-13, macos-14, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Get nightly version to use id: nightly shell: bash run: echo "version=$(cat .github/nightly-version)" >> $GITHUB_OUTPUT - name: Build Dependencies uses: ./.github/actions/build-dependencies - name: Install nightly rust run: rustup toolchain install ${{ steps.nightly.outputs.version }} --profile minimal -t wasm32-unknown-unknown -c clippy - name: Run Clippy run: cargo +${{ steps.nightly.outputs.version }} clippy --all-features --all-targets -- -D warnings -A clippy::items_after_test_module # Also verify the lockfile isn't dirty # This happens when someone edits a Cargo.toml yet doesn't do anything # which causes the lockfile to be updated # The above clippy run will cause it to be updated, so checking there's # no differences present now performs the desired check - name: Verify lockfile shell: bash run: git diff | wc -l | LC_ALL="en_US.utf8" grep -x -e "^[ ]*0" deny: runs-on: ubuntu-latest steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Advisory Cache uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: ~/.cargo/advisory-db key: rust-advisory-db - name: Install cargo deny run: cargo install --locked cargo-deny - name: Run cargo deny run: cargo deny -L error --all-features check fmt: runs-on: ubuntu-latest steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Get nightly version to use id: nightly shell: bash run: echo "version=$(cat .github/nightly-version)" >> $GITHUB_OUTPUT - name: Install nightly rust run: rustup toolchain install ${{ steps.nightly.outputs.version }} --profile minimal -c rustfmt - name: Run rustfmt run: cargo +${{ steps.nightly.outputs.version }} fmt -- --check - name: Install foundry uses: foundry-rs/foundry-toolchain@8f1998e9878d786675189ef566a2e4bf24869773 with: version: nightly-41d4e5437107f6f42c7711123890147bc736a609 cache: false - name: Run forge fmt run: FOUNDRY_FMT_SORT_INPUTS=false FOUNDRY_FMT_LINE_LENGTH=100 FOUNDRY_FMT_TABLE_WIDTH=2 FOUNDRY_FMT_BRACKET_SPACING=true FOUNDRY_FMT_INT_TYPES=preserve forge fmt --check $(find . -iname "*.sol") machete: runs-on: ubuntu-latest steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - name: Verify all dependencies are in use run: | cargo install cargo-machete cargo machete