Skip to content

Commit 75ff7f7

Browse files
ci: add cargo-deny, cargo-machete and cargo-sort (#121)
1 parent a17a7fc commit 75ff7f7

21 files changed

Lines changed: 594 additions & 642 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,44 @@ on:
66
branches:
77
- main
88

9+
env:
10+
RUSTFLAGS: '-Dwarnings'
11+
912
jobs:
1013
lint:
1114
name: Lint
1215
runs-on: ubuntu-latest
1316

14-
env:
15-
RUSTFLAGS: '-Dwarnings'
16-
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

2121
- name: Set up Rust toolchain
22-
run: rustup toolchain install stable --no-self-update --profile default --target wasm32-unknown-unknown
23-
24-
- name: Set up Rust cache
25-
uses: swatinem/rust-cache@v2
22+
uses: actions-rust-lang/setup-rust-toolchain@v1
2623
with:
27-
cache-on-failure: true
28-
save-if: ${{ github.ref == 'refs/heads/main' }}
24+
components: clippy, rustfmt
25+
target: wasm32-unknown-unknown
2926

30-
- name: Check formatting
31-
run: cargo fmt --all --check
27+
- name: Install Cargo Binary Install
28+
uses: cargo-bins/cargo-binstall@main
29+
30+
- name: Install crates
31+
run: cargo binstall -y cargo-deny cargo-machete cargo-sort
3232

3333
- name: Lint
34-
run: cargo clippy --all-features
34+
run: cargo clippy --all-features --locked
35+
36+
- name: Check dependencies
37+
run: cargo deny check
38+
39+
- name: Check unused dependencies
40+
run: cargo machete
41+
42+
- name: Check manifest formatting
43+
run: cargo sort --check
44+
45+
- name: Check formatting
46+
run: cargo fmt --all --check
3547

3648
test:
3749
name: Test
@@ -62,13 +74,10 @@ jobs:
6274
uses: actions/checkout@v4
6375

6476
- name: Set up Rust toolchain
65-
run: rustup toolchain install stable --no-self-update --profile default --target wasm32-unknown-unknown
66-
67-
- name: Set up Rust cache
68-
uses: swatinem/rust-cache@v2
77+
uses: actions-rust-lang/setup-rust-toolchain@v1
6978
with:
70-
cache-on-failure: true
71-
save-if: ${{ github.ref == 'refs/heads/main' }}
79+
components: clippy, rustfmt
80+
target: wasm32-unknown-unknown
7281

7382
- name: Install Cargo Binary Install
7483
uses: cargo-bins/cargo-binstall@main
@@ -77,4 +86,4 @@ jobs:
7786
run: cargo binstall -y sea-orm-cli
7887

7988
- name: Test
80-
run: cargo test --all-features
89+
run: cargo test --all-features --locked

.github/workflows/release.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ jobs:
2929
uses: actions/checkout@v4
3030

3131
- name: Set up Rust toolchain
32-
run: rustup toolchain install stable --no-self-update --profile default --target wasm32-unknown-unknown
33-
34-
- name: Set up Rust cache
35-
uses: swatinem/rust-cache@v2
32+
uses: actions-rust-lang/setup-rust-toolchain@v1
3633
with:
37-
cache-on-failure: true
38-
save-if: ${{ github.ref == 'refs/heads/main' }}
34+
components: clippy, rustfmt
35+
target: wasm32-unknown-unknown
3936

4037
- name: Install Cargo Binary Install
4138
uses: cargo-bins/cargo-binstall@main

.github/workflows/website.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ jobs:
1717
- uses: actions/checkout@v4
1818

1919
- name: Set up Rust toolchain
20-
run: |
21-
rustup toolchain install stable --no-self-update --profile minimal
22-
rustup target add wasm32-unknown-unknown
23-
24-
- name: Set up Rust cache
25-
uses: swatinem/rust-cache@v2
20+
uses: actions-rust-lang/setup-rust-toolchain@v1
2621
with:
27-
cache-on-failure: true
28-
save-if: ${{ github.ref == 'refs/heads/main' }}
22+
target: wasm32-unknown-unknown
2923

3024
- name: Install Cargo Binary Install
3125
uses: cargo-bins/cargo-binstall@main
@@ -47,15 +41,9 @@ jobs:
4741
fetch-depth: 0
4842

4943
- name: Set up Rust toolchain
50-
run: |
51-
rustup toolchain install stable --no-self-update --profile minimal
52-
rustup target add wasm32-unknown-unknown
53-
54-
- name: Set up Rust cache
55-
uses: swatinem/rust-cache@v2
44+
uses: actions-rust-lang/setup-rust-toolchain@v1
5645
with:
57-
cache-on-failure: true
58-
save-if: ${{ github.ref == 'refs/heads/main' }}
46+
target: wasm32-unknown-unknown
5947

6048
- name: Install Cargo Binary Install
6149
uses: cargo-bins/cargo-binstall@main

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,33 @@ repos:
55
- id: prettier
66
additional_dependencies:
77
- prettier@^3.4.2
8+
89
- repo: https://github.com/doublify/pre-commit-rust
910
rev: v1.0
1011
hooks:
1112
- id: fmt
1213
- id: clippy
14+
15+
- repo: https://github.com/EmbarkStudios/cargo-deny
16+
rev: 0.18.3
17+
hooks:
18+
- id: cargo-deny
19+
20+
# - repo: https://github.com/bnjbvr/cargo-machete
21+
# rev: ba1bcd4
22+
# hooks:
23+
# - id: cargo-machete
24+
- repo: local
25+
hooks:
26+
- id: cargo-machete
27+
name: cargo-machete
28+
language: rust
29+
entry: cargo machete
30+
types: [file, toml]
31+
files: Cargo\.(toml|lock)
32+
pass_filenames: false
33+
34+
- repo: https://github.com/DevinR528/cargo-sort
35+
rev: v2.0.1
36+
hooks:
37+
- id: cargo-sort

0 commit comments

Comments
 (0)