Skip to content

Commit 3f2ca2f

Browse files
committed
refactor(ci)!: add new fmt and clippy jobs
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
1 parent 9f888c1 commit 3f2ca2f

File tree

2 files changed

+48
-10
lines changed

2 files changed

+48
-10
lines changed

.github/workflows/cont_integration.yml

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
matrix:
1818
rust:
1919
- version: stable # STABLE
20-
clippy: true
2120
- version: 1.63.0 # MSRV
2221
features:
2322
- default
@@ -32,7 +31,8 @@ jobs:
3231
- async-https-rustls
3332
- async-https-rustls-manual-roots
3433
steps:
35-
- uses: actions/checkout@v4
34+
- name: Checkout
35+
uses: actions/checkout@v4
3636
- name: Generate cache key
3737
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key
3838
- name: Rust Cache
@@ -43,13 +43,12 @@ jobs:
4343
~/.cargo/git
4444
target
4545
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
46-
- name: Set default toolchain
47-
run: rustup default ${{ matrix.rust.version }}
46+
- name: Install Rust Toolchain
47+
uses: dtolnay/rust-toolchain@v1
48+
with:
49+
toolchain: ${{ matrix.rust.version }}
4850
- name: Set profile
4951
run: rustup set profile minimal
50-
- name: Add clippy
51-
if: ${{ matrix.rust.clippy }}
52-
run: rustup component add clippy
5352
- name: Update toolchain
5453
run: rustup update
5554
- name: Pin dependencies for MSRV
@@ -62,8 +61,44 @@ jobs:
6261
cargo update -p tokio --precise "1.38.1"
6362
- name: Build
6463
run: cargo build --features ${{ matrix.features }} --no-default-features
65-
- name: Clippy
66-
if: ${{ matrix.rust.clippy }}
67-
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
6864
- name: Test
6965
run: cargo test --features ${{ matrix.features }} --no-default-features -- --test-threads=1
66+
67+
fmt:
68+
name: Rust Formatting
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
- name: Install Rust Toolchain
74+
uses: dtolnay/rust-toolchain@v1
75+
with:
76+
toolchain: nightly
77+
components: rustfmt
78+
- name: Check fmt
79+
run: cargo fmt --all --check
80+
81+
clippy:
82+
name: Rust Clippy
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
- name: Install Rust Toolchain
88+
uses: dtolnay/rust-toolchain@v1
89+
with:
90+
toolchain: stable
91+
components: clippy
92+
- name: Rust Cache
93+
uses: actions/cache@v3
94+
with:
95+
path: |
96+
~/.cargo/registry
97+
~/.cargo/git
98+
target
99+
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
100+
- name: Check clippy
101+
uses: actions-rs/clippy-check@v1
102+
with:
103+
token: ${{ secrets.GITHUB_TOKEN }}
104+
args: --all-features --all-targets -- -D warnings

.rustfmt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
format_code_in_doc_comments=true
2+
wrap_comments=true
3+
comment_width=100

0 commit comments

Comments
 (0)