Skip to content

Commit

Permalink
refactor(ci)!: add new fmt and clippy jobs
Browse files Browse the repository at this point in the history
refactor(ci)!: add new `fmt` and `clippy` jobs

- adds two new jobs for `fmt` and `clippy`.
- use `dtolnay/rust-toolchain@v1` instead of `actions-rs/toolchain@v1`

chore(rustfmt): add `.rustfmt.toml` and use `nighly on fmt CI step
  • Loading branch information
oleonardolima committed Sep 1, 2024
1 parent 9f888c1 commit 3f2ca2f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
55 changes: 45 additions & 10 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
matrix:
rust:
- version: stable # STABLE
clippy: true
- version: 1.63.0 # MSRV
features:
- default
Expand All @@ -32,7 +31,8 @@ jobs:
- async-https-rustls
- async-https-rustls-manual-roots
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Generate cache key
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key
- name: Rust Cache
Expand All @@ -43,13 +43,12 @@ jobs:
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Set default toolchain
run: rustup default ${{ matrix.rust.version }}
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust.version }}
- name: Set profile
run: rustup set profile minimal
- name: Add clippy
if: ${{ matrix.rust.clippy }}
run: rustup component add clippy
- name: Update toolchain
run: rustup update
- name: Pin dependencies for MSRV
Expand All @@ -62,8 +61,44 @@ jobs:
cargo update -p tokio --precise "1.38.1"
- name: Build
run: cargo build --features ${{ matrix.features }} --no-default-features
- name: Clippy
if: ${{ matrix.rust.clippy }}
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
- name: Test
run: cargo test --features ${{ matrix.features }} --no-default-features -- --test-threads=1

fmt:
name: Rust Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Check fmt
run: cargo fmt --all --check

clippy:
name: Rust Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: clippy
- name: Rust Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Check clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
format_code_in_doc_comments=true
wrap_comments=true
comment_width=100

0 comments on commit 3f2ca2f

Please sign in to comment.