Skip to content

Commit 9c4df86

Browse files
committed
chore: add security toolchain config (deny/clippy/rustfmt/audit/ci)
- Add deny.toml, clippy.toml, rustfmt.toml - Add .cargo/audit.toml, .github/workflows/ci.yml, sec-audit.yml - Update Cargo.toml/Cargo.lock (dependency cleanup)
1 parent 465a0e2 commit 9c4df86

8 files changed

Lines changed: 445 additions & 364 deletions

File tree

.cargo/audit.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[advisories]
2+
ignore = []
3+
informational_warnings = ["unmaintained"]
4+
severity_threshold = "low"
5+
6+
[database]
7+
fetch = true
8+
stale = false
9+
10+
[output]
11+
deny = ["unmaintained"]
12+
format = "terminal"
13+
quiet = false
14+
show_tree = true
15+
16+
[yanked]
17+
enabled = true
18+
update_index = true

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ci-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
RUSTFLAGS: "-D warnings"
16+
17+
jobs:
18+
lint:
19+
name: Lint
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dtolnay/rust-toolchain@stable
25+
with:
26+
components: clippy, rustfmt
27+
- uses: Swatinem/rust-cache@v2
28+
29+
- name: Format check
30+
run: cargo fmt --all -- --check
31+
32+
- name: Clippy
33+
run: cargo clippy --all-targets --all-features
34+
35+
- name: Unused deps
36+
run: |
37+
cargo install cargo-machete --locked
38+
cargo machete
39+
40+
test:
41+
name: Test
42+
needs: lint
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 30
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: dtolnay/rust-toolchain@stable
48+
- uses: Swatinem/rust-cache@v2
49+
- name: Run tests
50+
run: cargo test --all-features
51+
52+
build:
53+
name: Build
54+
needs: lint
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 30
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: dtolnay/rust-toolchain@stable
60+
- uses: Swatinem/rust-cache@v2
61+
- name: Build release
62+
run: cargo build --release

.github/workflows/sec-audit.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Sec Audit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "Cargo.toml"
8+
- "Cargo.lock"
9+
- "deny.toml"
10+
- '.cargo/audit.toml'
11+
pull_request:
12+
branches: [main]
13+
paths:
14+
- "Cargo.toml"
15+
- "Cargo.lock"
16+
- "deny.toml"
17+
- '.cargo/audit.toml'
18+
schedule:
19+
- cron: "0 6 * * 1"
20+
21+
concurrency:
22+
group: security-${{ github.event.pull_request.number || github.ref }}
23+
cancel-in-progress: true
24+
25+
permissions:
26+
contents: read
27+
issues: write
28+
29+
env:
30+
CARGO_TERM_COLOR: always
31+
32+
jobs:
33+
audit:
34+
name: Security Audit
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 35
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: rustsec/audit-check@v2.0.0
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
43+
deny:
44+
name: License & Supply Chain
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 35
47+
strategy:
48+
matrix:
49+
checks:
50+
- advisories
51+
- bans licenses sources
52+
continue-on-error: ${{ matrix.checks == 'advisories' }}
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: EmbarkStudios/cargo-deny-action@v2
56+
with:
57+
command: check ${{ matrix.checks }}
58+
arguments: --all-features

0 commit comments

Comments
 (0)