Skip to content

Commit

Permalink
refac: run clippy for entire codebase
Browse files Browse the repository at this point in the history
This PR runs clippy and formatter to the entire PR.

Also updates the GH action to ensure it is formatted.
  • Loading branch information
saiintbrisson committed Feb 4, 2024
1 parent 23b2690 commit fc09bdc
Show file tree
Hide file tree
Showing 40 changed files with 2,786 additions and 3,092 deletions.
13 changes: 13 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[target.'cfg(all())']
# Enable global lints
rustflags = [
# TODO: remove once we refactor the code
"-Aclippy::too_many_arguments",
"-Aclippy::type_complexity",
]

[registries.crates-io]
protocol = "sparse"

[build]
rustflags = ["-Z", "threads=8"]
59 changes: 41 additions & 18 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,57 @@ on:
jobs:
check:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Set-Up
run: sudo apt install -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: 3.20.1
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup default stable
rustup update nightly
rustup update stable
rustup target add wasm32-unknown-unknown --toolchain nightly
- name: Check Build
- name: Set-up Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: registry-main-cache
cache-targets: false
cache-all-crates: false
cache-on-failure: true
save-if: ${{ github.ref_name == 'main' }}

- name: Install Rust toolchain
run: |
SKIP_WASM_BUILD=1 cargo check --release
rustup set profile minimal
rustup show
- name: Ensure Rust formatting
id: rust-formatter
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

- name: Check code errors
id: rust-clippy
uses: actions-rs/clippy-check@v1
env:
SKIP_WASM_BUILD: 1
with:
args: >-
--color=always --timings -- -D warnings
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: |
cargo test
id: rust-test
env:
SKIP_WASM_BUILD: 1
run: cargo test

- name: Check Build for Benchmarking
run: >
pushd node &&
run: |
pushd node
cargo check --features=runtime-benchmarks --release
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

.DS_Store

# The cache for docker container dependency
.cargo

# The cache for chain data in container
.local

# direnv cache
.direnv

Expand Down
Loading

0 comments on commit fc09bdc

Please sign in to comment.