2023-07-14 17:02:58 +00:00
|
|
|
name: Lint
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- develop
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
clippy:
|
2024-02-01 00:10:39 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-02-06 04:53:57 +00:00
|
|
|
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
|
2024-02-01 00:10:39 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
2023-07-14 17:02:58 +00:00
|
|
|
steps:
|
2023-09-15 18:30:18 +00:00
|
|
|
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
|
2023-07-14 17:02:58 +00:00
|
|
|
|
|
|
|
- name: Get nightly version to use
|
|
|
|
id: nightly
|
2024-02-01 00:10:39 +00:00
|
|
|
shell: bash
|
2023-07-14 17:02:58 +00:00
|
|
|
run: echo "version=$(cat .github/nightly-version)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Build Dependencies
|
|
|
|
uses: ./.github/actions/build-dependencies
|
2023-11-20 07:31:22 +00:00
|
|
|
|
|
|
|
- name: Install nightly rust
|
|
|
|
run: rustup toolchain install ${{ steps.nightly.outputs.version }} --profile minimal -t wasm32-unknown-unknown -c clippy
|
2023-07-14 17:02:58 +00:00
|
|
|
|
|
|
|
- name: Run Clippy
|
2023-11-20 07:31:22 +00:00
|
|
|
run: cargo +${{ steps.nightly.outputs.version }} clippy --all-features --all-targets -- -D warnings -A clippy::items_after_test_module
|
2023-07-14 17:02:58 +00:00
|
|
|
|
2023-12-05 09:55:47 +00:00
|
|
|
# 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
|
2024-02-02 02:31:02 +00:00
|
|
|
shell: bash
|
|
|
|
run: git diff | wc -l | LC_ALL="en_US.utf8" grep -x -e "^[ ]*0"
|
2023-12-05 09:55:47 +00:00
|
|
|
|
2023-07-14 17:02:58 +00:00
|
|
|
deny:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-15 18:30:18 +00:00
|
|
|
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
|
2023-07-14 17:02:58 +00:00
|
|
|
|
|
|
|
- name: Advisory Cache
|
2024-02-02 01:52:17 +00:00
|
|
|
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
|
2023-07-14 17:02:58 +00:00
|
|
|
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:
|
2023-09-15 18:30:18 +00:00
|
|
|
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
|
2023-07-14 17:02:58 +00:00
|
|
|
|
|
|
|
- name: Get nightly version to use
|
|
|
|
id: nightly
|
2024-02-01 00:10:39 +00:00
|
|
|
shell: bash
|
2023-07-14 17:02:58 +00:00
|
|
|
run: echo "version=$(cat .github/nightly-version)" >> $GITHUB_OUTPUT
|
|
|
|
|
2023-11-20 07:31:22 +00:00
|
|
|
- name: Install nightly rust
|
|
|
|
run: rustup toolchain install ${{ steps.nightly.outputs.version }} --profile minimal -c rustfmt
|
2023-07-14 17:02:58 +00:00
|
|
|
|
|
|
|
- name: Run rustfmt
|
|
|
|
run: cargo +${{ steps.nightly.outputs.version }} fmt -- --check
|
2023-11-13 04:55:15 +00:00
|
|
|
|
2024-09-17 01:34:59 +00:00
|
|
|
- name: Install foundry
|
|
|
|
uses: foundry-rs/foundry-toolchain@8f1998e9878d786675189ef566a2e4bf24869773
|
|
|
|
with:
|
|
|
|
version: nightly-41d4e5437107f6f42c7711123890147bc736a609
|
|
|
|
cache: false
|
|
|
|
|
|
|
|
- name: Run forge fmt
|
2024-09-20 03:23:41 +00:00
|
|
|
run: FOUNDRY_FMT_SORT_INPUTS=false FOUNDRY_FMT_LINE_LENGTH=100 FOUNDRY_FMT_TAB_WIDTH=2 FOUNDRY_FMT_BRACKET_SPACING=true FOUNDRY_FMT_INT_TYPES=preserve forge fmt --check $(find . -iname "*.sol")
|
2024-09-17 01:34:59 +00:00
|
|
|
|
2023-12-12 04:02:06 +00:00
|
|
|
machete:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
|
|
|
|
- name: Verify all dependencies are in use
|
|
|
|
run: |
|
|
|
|
cargo install cargo-machete
|
|
|
|
cargo machete
|