Skip to content

Commit ceb3d3c

Browse files
authored
ci: Deduplicate checks and tests (#1127)
1 parent 4dac3ab commit ceb3d3c

File tree

3 files changed

+83
-116
lines changed

3 files changed

+83
-116
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Security Checks
3+
4+
on:
5+
pull_request:
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
CARGO_INCREMENTAL: "0"
10+
CARGO_PROFILE_DEV_DEBUG: "0"
11+
RUST_TOOLCHAIN_VERSION: "1.89.0"
12+
RUSTFLAGS: "-D warnings"
13+
RUSTDOCFLAGS: "-D warnings"
14+
RUST_LOG: "info"
15+
16+
permissions: {}
17+
18+
jobs:
19+
# Identify unused dependencies
20+
cargo-udeps:
21+
name: Run Cargo Udeps
22+
runs-on: ubuntu-latest
23+
env:
24+
RUSTC_BOOTSTRAP: 1
25+
steps:
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
with:
28+
persist-credentials: false
29+
- uses: dtolnay/rust-toolchain@master
30+
with:
31+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
32+
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
33+
with:
34+
key: udeps
35+
- run: cargo install --locked cargo-udeps@0.1.59
36+
- run: cargo udeps --all-targets --all-features
37+
38+
cargo-deny:
39+
name: Run Cargo Deny
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
checks:
44+
- advisories
45+
- bans licenses sources
46+
47+
# Prevent sudden announcement of a new advisory from failing ci:
48+
continue-on-error: ${{ matrix.checks == 'advisories' }}
49+
50+
steps:
51+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
52+
with:
53+
persist-credentials: false
54+
- uses: dtolnay/rust-toolchain@master
55+
with:
56+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
57+
- uses: EmbarkStudios/cargo-deny-action@76cd80eb775d7bbbd2d80292136d74d39e1b4918 # v2.0.14
58+
with:
59+
command: check ${{ matrix.checks }}

.pre-commit-config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,30 @@ repos:
4747
stages: [pre-commit, pre-merge-commit, manual]
4848
pass_filenames: false
4949

50+
- id: cargo-doc
51+
name: cargo-doc
52+
language: system
53+
entry: cargo doc --document-private-items
54+
stages: [pre-commit, pre-merge-commit]
55+
pass_filenames: false
56+
files: \.rs$|Cargo\.(toml|lock)
57+
58+
- id: cargo-test-no-default-features
59+
name: cargo-test-no-default-features
60+
language: system
61+
entry: cargo test --no-default-features --workspace
62+
stages: [pre-commit, pre-merge-commit]
63+
pass_filenames: false
64+
files: \.rs$|Cargo\.(toml|lock)
65+
66+
- id: cargo-test-all-features
67+
name: cargo-test-all-features
68+
language: system
69+
entry: cargo test --all-features --workspace
70+
stages: [pre-commit, pre-merge-commit]
71+
pass_filenames: false
72+
files: \.rs$|Cargo\.(toml|lock)
73+
5074
- id: cargo-rustfmt
5175
name: cargo-rustfmt
5276
language: system

0 commit comments

Comments
 (0)