mirror of
https://github.com/logos-blockchain/logos-blockchain-circuits.git
synced 2026-05-18 23:39:47 +00:00
106 lines
3.1 KiB
YAML
106 lines
3.1 KiB
YAML
name: Lint
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # v4.2.2
|
|
|
|
# Stable toolchain for building and clippy, version and components from rust-toolchain.toml.
|
|
- name: Install Rust Toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
|
|
|
|
# Nightly toolchain for rustfmt only — nightly is required for formatting features not yet stable.
|
|
- name: Install Nightly Toolchain (fmt)
|
|
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
|
|
with:
|
|
toolchain: nightly-2026-02-28
|
|
components: rustfmt
|
|
override: 'false'
|
|
|
|
- name: Cache Cargo artifacts
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
rust/target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock', 'rust/Cargo.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Install taplo
|
|
run: cargo install taplo-cli --version 0.9.3 --locked # v0.9.3
|
|
|
|
- name: Install cargo-deny
|
|
run: cargo install cargo-deny --version 0.19.4 --locked # v0.19.4
|
|
|
|
- name: Install cargo-machete
|
|
run: cargo install cargo-machete --version 0.9.2 --locked # v0.9.2
|
|
|
|
- name: Check Rust formatting
|
|
id: fmt
|
|
continue-on-error: true
|
|
run: cargo +nightly-2026-02-28 fmt --manifest-path rust/Cargo.toml --all -- --check
|
|
|
|
- name: Audit dependencies
|
|
id: deny
|
|
continue-on-error: true
|
|
run: >
|
|
cargo deny
|
|
--manifest-path rust/Cargo.toml
|
|
--locked
|
|
--all-features
|
|
check
|
|
--hide-inclusion-graph
|
|
-c .cargo-deny.toml
|
|
--show-stats
|
|
-D warnings
|
|
|
|
- name: Check TOML formatting
|
|
id: taplo-fmt
|
|
continue-on-error: true
|
|
run: taplo fmt --check
|
|
|
|
- name: Lint TOML
|
|
id: taplo-lint
|
|
continue-on-error: true
|
|
run: taplo lint
|
|
|
|
- name: Check unused dependencies
|
|
id: machete
|
|
continue-on-error: true
|
|
run: cargo machete rust/
|
|
|
|
- name: Report
|
|
if: always()
|
|
run: |
|
|
pass="✅" fail="❌"
|
|
failed=false
|
|
|
|
check() {
|
|
local name="$1" outcome="$2"
|
|
if [ "$outcome" = "success" ]; then
|
|
echo "$pass $name"
|
|
else
|
|
echo "$fail $name ($outcome)"
|
|
failed=true
|
|
fi
|
|
}
|
|
|
|
check "rustfmt" "${{ steps.fmt.outcome }}"
|
|
check "cargo-deny" "${{ steps.deny.outcome }}"
|
|
check "taplo fmt" "${{ steps.taplo-fmt.outcome }}"
|
|
check "taplo lint" "${{ steps.taplo-lint.outcome }}"
|
|
check "cargo-machete" "${{ steps.machete.outcome }}"
|
|
|
|
$failed && exit 1 || true
|