Skip to content

Commit e67b8f0

Browse files
committed
ci: cover fmt, clippy, tests, doc, advisories, and MSRV
Rewrites the CI workflow so the fork can stand on its own: the original job did only fmt + build/test, which left clippy regressions, doc-link breakage, and advisory drift to surface in PR review. The new pipeline runs six parallel jobs sharing a Swatinem cargo cache: - fmt cargo fmt --check - clippy -D warnings, excluding typify-test (its codegen output trips clippy::derivable_impls / redundant_closure; those are codegen quality issues, not source-tree issues) - test build + test on Linux, Windows, macOS - doc cargo doc --no-deps -D warnings (intra-doc-link guard) - deny cargo deny check advisories - msrv cargo build on Rust 1.82 Adds a `deny.toml` ignore-list for four pre-existing unmaintained-crate advisories (adler, paste, tempdir, remove_dir_all). Each entry carries a note explaining the chain and the cleanup path; the tempdir/CVE pair cancels automatically once cargo-typify swaps to tempfile. Adds `#[allow(dead_code)]` to two `#[cfg(test)]` helpers in util.rs (`all_mutually_exclusive`, `resolve`) that are currently unused but referenced by a TODO comment to be wired back up.
1 parent c2cbcc3 commit e67b8f0

3 files changed

Lines changed: 108 additions & 20 deletions

File tree

.github/workflows/rust.yml

Lines changed: 76 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,90 @@
11
#
2-
# Configuration for GitHub-based CI
2+
# Configuration for GitHub-based CI.
33
#
4-
name: Build
4+
# Runs fmt / clippy / tests / docs / advisories / MSRV in parallel on
5+
# every PR and every push to main. All jobs share a Swatinem cargo
6+
# cache keyed off Cargo.lock. Toolchain is `stable` everywhere except
7+
# the MSRV job, which pins Rust 1.82.
8+
#
9+
name: CI
510

611
on:
712
push:
8-
branches: [ main ]
13+
branches: [main]
914
pull_request:
10-
branches: [ main ]
15+
branches: [main]
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
CARGO_INCREMENTAL: 0
20+
RUST_BACKTRACE: 1
1121

1222
jobs:
13-
check-style:
23+
fmt:
24+
name: cargo fmt
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: dtolnay/rust-toolchain@stable
29+
with:
30+
components: rustfmt
31+
- run: cargo fmt --all -- --check
32+
33+
clippy:
34+
name: cargo clippy
1435
runs-on: ubuntu-latest
1536
steps:
16-
- uses: actions/checkout@v2
17-
- name: Report cargo version
18-
run: cargo --version
19-
- name: Report rustfmt version
20-
run: cargo fmt -- --version
21-
- name: Check style
22-
run: cargo fmt -- --check
23-
24-
build-and-test:
37+
- uses: actions/checkout@v4
38+
- uses: dtolnay/rust-toolchain@stable
39+
with:
40+
components: clippy
41+
- uses: Swatinem/rust-cache@v2
42+
# typify-test only exists to compile typify's generated output; the
43+
# warnings it surfaces (clippy::derivable_impls, redundant_closure)
44+
# belong to the codegen, not source code, and are tracked separately.
45+
- run: cargo clippy --workspace --all-targets --locked --exclude typify-test -- -D warnings
46+
47+
test:
48+
name: test (${{ matrix.os }})
2549
runs-on: ${{ matrix.os }}
2650
strategy:
51+
fail-fast: false
2752
matrix:
28-
os: [ ubuntu-latest, windows-latest, macos-latest ]
53+
os: [ubuntu-latest, windows-latest, macos-latest]
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: dtolnay/rust-toolchain@stable
57+
- uses: Swatinem/rust-cache@v2
58+
- name: Build
59+
run: cargo build --workspace --locked --tests --verbose
60+
- name: Test
61+
run: cargo test --workspace --locked --verbose
62+
63+
doc:
64+
name: cargo doc
65+
runs-on: ubuntu-latest
66+
env:
67+
RUSTDOCFLAGS: "-D warnings"
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: dtolnay/rust-toolchain@stable
71+
- uses: Swatinem/rust-cache@v2
72+
- run: cargo doc --workspace --no-deps --locked
73+
74+
deny:
75+
name: cargo deny (advisories)
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: EmbarkStudios/cargo-deny-action@v2
80+
with:
81+
command: check advisories
82+
83+
msrv:
84+
name: MSRV build (1.82)
85+
runs-on: ubuntu-latest
2986
steps:
30-
- uses: actions/checkout@v2
31-
- name: Build
32-
run: cargo build --locked --tests --verbose
33-
- name: Run tests
34-
run: cargo test --locked --verbose
87+
- uses: actions/checkout@v4
88+
- uses: dtolnay/rust-toolchain@1.82
89+
- uses: Swatinem/rust-cache@v2
90+
- run: cargo build --workspace --locked

deny.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# cargo-deny configuration.
2+
#
3+
# CI runs `cargo deny check advisories`. The ignore list below covers
4+
# unmaintained-crate advisories and one CVE that all enter the tree
5+
# transitively through dev-dependencies; none affect published crate
6+
# code paths. Re-evaluate when bumping or removing the cited dep.
7+
8+
[advisories]
9+
ignore = [
10+
# adler 1.0.2 — unmaintained, superseded by adler2.
11+
# Pulled in transitively by miniz_oxide. Wait for the ecosystem to
12+
# migrate (mostly through flate2/png updates).
13+
"RUSTSEC-2025-0056",
14+
15+
# paste 1.0.15 — unmaintained, see pastey / with_builtin_macros.
16+
# Used by both typify's generated code (paste in workspace deps)
17+
# and several transitive deps. Worth replacing in generated output.
18+
"RUSTSEC-2024-0436",
19+
20+
# tempdir 0.3.7 — deprecated in favour of tempfile.
21+
# Dev-dependency of cargo-typify only (integration tests). TODO:
22+
# swap to tempfile and drop both this and RUSTSEC-2023-0018.
23+
"RUSTSEC-2018-0017",
24+
25+
# remove_dir_all 0.5.3 — race-condition CVE.
26+
# Reaches the tree only via tempdir (above) in cargo-typify dev
27+
# tests. No production code path. Cleared automatically once the
28+
# tempdir → tempfile swap above lands.
29+
"RUSTSEC-2023-0018",
30+
]

typify-impl/src/util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub(crate) fn metadata_title_and_description(metadata: &Option<Box<Metadata>>) -
5151
/// conceptually identical to the logic below that validates **if** the schemas
5252
/// **could** be merged (i.e. if they're compatible).
5353
#[cfg(test)]
54+
#[allow(dead_code)]
5455
pub(crate) fn all_mutually_exclusive(
5556
subschemas: &[Schema],
5657
definitions: &BTreeMap<RefKey, Schema>,
@@ -573,6 +574,7 @@ pub(crate) fn ref_key(ref_name: &str) -> RefKey {
573574
}
574575

575576
#[cfg(test)]
577+
#[allow(dead_code)]
576578
fn resolve<'a>(
577579
schema: &'a Schema,
578580
definitions: &'a std::collections::BTreeMap<RefKey, Schema>,

0 commit comments

Comments
 (0)