Skip to content

Commit 9879b23

Browse files
committed
chore: update GitHub workflows and add cargo audit configuration
- Introduced .cargo/audit.toml to manage advisory ignores. - Updated GitHub Actions workflows to use actions/checkout@v4 and added steps to install Rust toolchain and cargo audit. - Modified audit and general workflows to run cargo audit and cargo fmt with the new configuration.
1 parent 29d1e2a commit 9879b23

4 files changed

Lines changed: 68 additions & 55 deletions

File tree

.cargo/audit.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[advisories]
2+
ignore = [
3+
"RUSTSEC-2020-0159",
4+
"RUSTSEC-2020-0071",
5+
"RUSTSEC-2021-0141",
6+
]
7+

.github/workflows/audit-cron.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
name: Security audit
22
on:
33
schedule:
4-
- cron: '0 0 * * *'
4+
- cron: "0 0 * * *"
55
jobs:
66
audit:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
10-
- uses: actions-rs/audit-check@v1
11-
with:
12-
token: ${{ secrets.GITHUB_TOKEN }}
13-
args: --ignore RUSTSEC-2020-0159 RUSTSEC-2020-0071 RUSTSEC-2021-0141
14-
continue-on-error: true
9+
- uses: actions/checkout@v4
10+
- name: Install stable
11+
uses: dtolnay/rust-toolchain@stable
12+
- name: Install cargo audit
13+
run: |
14+
cargo install cargo-audit
15+
16+
- name: Run cargo audit
17+
run: cargo audit --file .cargo/audit.toml

.github/workflows/audit.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ name: Security audit
22
on:
33
push:
44
paths:
5-
- '**/Cargo.toml'
6-
- '**/Cargo.lock'
5+
- "**/Cargo.toml"
6+
- "**/Cargo.lock"
77
jobs:
88
security_audit:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions-rs/audit-check@v1
13-
with:
14-
token: ${{ secrets.GITHUB_TOKEN }}
15-
args: --ignore RUSTSEC-2020-0159 RUSTSEC-2020-0071 RUSTSEC-2021-0141
16-
continue-on-error: true
11+
- uses: actions/checkout@v4
12+
- name: Install stable
13+
uses: dtolnay/rust-toolchain@stable
14+
- name: Install cargo audit
15+
run: |
16+
cargo install cargo-audit
17+
18+
- name: Run cargo audit
19+
run: cargo audit --file .cargo/audit.toml

.github/workflows/general.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,57 @@ on: [push, pull_request]
55
env:
66
CARGO_TERM_COLOR: always
77

8-
jobs:
9-
test:
10-
name: Test
11-
runs-on: ubuntu-latest
12-
env:
13-
CONSUMER_KEY: ${{ secrets.CLIENT_KEY }}
14-
CONSUMER_SECRET: ${{ secrets.CLIENT_SECRET }}
15-
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions-rs/toolchain@v1
18-
with:
19-
profile: minimal
20-
toolchain: stable
21-
override: true
22-
- uses: actions-rs/cargo@v1
23-
with:
24-
command: test
25-
args: --no-fail-fast
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
2611

12+
jobs:
2713
fmt:
2814
name: Rustfmt
2915
runs-on: ubuntu-latest
3016
steps:
31-
- uses: actions/checkout@v2
32-
- uses: actions-rs/toolchain@v1
17+
- uses: actions/checkout@v4
18+
- name: Install stable
19+
uses: dtolnay/rust-toolchain@stable
3320
with:
34-
toolchain: stable
35-
override: true
3621
components: rustfmt
37-
- uses: actions-rs/cargo@v1
38-
with:
39-
command: fmt
40-
args: --all -- --check
22+
- name: Run cargo fmt
23+
run: |
24+
cargo fmt --check
4125
4226
clippy:
4327
name: Clippy
4428
runs-on: ubuntu-latest
4529
steps:
46-
- uses: actions/checkout@v2
47-
- uses: actions-rs/toolchain@v1
30+
- uses: actions/checkout@v4
31+
- name: Install stable
32+
uses: dtolnay/rust-toolchain@stable
4833
with:
49-
toolchain: stable
5034
override: true
5135
components: clippy
52-
- uses: actions-rs/clippy-check@v1
53-
with:
54-
token: ${{ secrets.GITHUB_TOKEN }}
55-
args: -- -D warnings
36+
- name: Run cargo clippy
37+
run: |
38+
cargo clippy --all-targets --all-features -- -D warnings
39+
40+
test:
41+
name: Test
42+
runs-on: ubuntu-latest
43+
env:
44+
CONSUMER_KEY: ${{ secrets.CLIENT_KEY }}
45+
CONSUMER_SECRET: ${{ secrets.CLIENT_SECRET }}
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Install stable
49+
uses: dtolnay/rust-toolchain@stable
50+
51+
- name: cargo generate-lockfile
52+
if: hashFiles('**/Cargo.lock') == ''
53+
run: |
54+
cargo generate-lockfile
55+
56+
- name: Run cargo test
57+
run: |
58+
cargo test --no-fail-fast --locked --all-features --all-targets
5659
5760
coverage:
5861
name: Code coverage
@@ -62,16 +65,13 @@ jobs:
6265
CONSUMER_SECRET: ${{ secrets.CLIENT_SECRET }}
6366
steps:
6467
- name: Checkout repository
65-
uses: actions/checkout@v2
68+
uses: actions/checkout@v4
6669

6770
- name: Install stable toolchain
68-
uses: actions-rs/toolchain@v1
69-
with:
70-
toolchain: stable
71-
override: true
71+
uses: dtolnay/rust-toolchain@nightly
7272

7373
- name: Run cargo-tarpaulin
7474
uses: actions-rs/tarpaulin@v0.1
7575
with:
76-
args: '--ignore-tests --no-fail-fast'
77-
version: '0.22.0'
76+
args: "--ignore-tests --no-fail-fast"
77+
version: "0.22.0"

0 commit comments

Comments
 (0)