diff --git a/Jenkinsfile b/Jenkinsfile index 1dce2db..0c934d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,8 @@ pipeline { RUST_BACKTRACE = '1' MSRV = '1.98.1' TARPAULIN_VERSION = '0.37.4' + CARGO_AUDIT_VERSION = '0.22.2' + CARGO_DENY_VERSION = '0.20.2' } stages { @@ -60,6 +62,16 @@ pipeline { --locked \ --version "${TARPAULIN_VERSION}" fi + + INSTALLED_AUDIT="$(cargo audit --version 2>/dev/null || true)" + if [ "${INSTALLED_AUDIT}" != "cargo-audit ${CARGO_AUDIT_VERSION}" ]; then + cargo install cargo-audit --locked --version "${CARGO_AUDIT_VERSION}" + fi + + INSTALLED_DENY="$(cargo deny --version 2>/dev/null || true)" + if [ "${INSTALLED_DENY}" != "cargo-deny ${CARGO_DENY_VERSION}" ]; then + cargo install cargo-deny --locked --version "${CARGO_DENY_VERSION}" + fi ''' } } @@ -136,6 +148,17 @@ pipeline { } } + stage('Fixtures and Goldens') { + steps { + sh ''' + set -eu + + cargo test --locked --test example_fixtures --all-features + cargo test --locked --test cli --all-features + ''' + } + } + stage('Coverage') { steps { sh ''' @@ -158,7 +181,30 @@ pipeline { cargo clippy \ --locked \ --all-targets \ - --all-features + --all-features \ + -- \ + -D warnings + ''' + } + } + + stage('Documentation') { + steps { + sh ''' + set -eu + + cargo doc --locked --no-deps --all-features + ''' + } + } + + stage('Supply Chain') { + steps { + sh ''' + set -eu + + cargo audit --deny warnings + cargo deny --locked check ''' } } @@ -193,7 +239,7 @@ pipeline { conclusion: 'SUCCESS', name: 'Rust CI', summary: 'JohnSlop passed all CI checks.', - text: 'Formatting, compilation checks, feature tests, coverage, Clippy, and the release build completed successfully.', + text: 'The Linux MSRV/stable matrix, formatting, feature tests, fixtures, docs, coverage, Clippy, supply-chain policy, and release build completed successfully.', title: 'Build Successful' ) @@ -205,7 +251,7 @@ pipeline { conclusion: 'FAILURE', name: 'Rust CI', summary: 'JohnSlop failed CI.', - text: 'Formatting, compilation, tests, coverage, Clippy, or the release build failed. Check the Jenkins log.', + text: 'A toolchain, formatting, test, fixture, documentation, coverage, Clippy, supply-chain, or release check failed. Check the Jenkins log.', title: 'Build Failed' ) diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..91d148f --- /dev/null +++ b/deny.toml @@ -0,0 +1,35 @@ +[graph] +all-features = true + +[advisories] +version = 2 +yanked = "deny" + +[licenses] +version = 2 +confidence-threshold = 0.8 +allow = [ + "0BSD", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-3-Clause", + "CC0-1.0", + "ISC", + "MIT", + "MIT-0", + "MPL-2.0", + "Unicode-3.0", + "Unlicense", + "Zlib", + "bzip2-1.0.6", +] + +[bans] +multiple-versions = "warn" +wildcards = "deny" +highlight = "all" + +[sources] +unknown-registry = "deny" +unknown-git = "deny" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] diff --git a/docs/development.md b/docs/development.md index 09ec1ff..203efc9 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,9 +1,10 @@ # Development The project uses Rust edition 2024 and requires Rust 1.98.1 or newer. The -committed lockfile makes application builds reproducible. Linux is the currently -exercised platform; other platforms are not declared supported until CI covers -them. +committed lockfile makes application builds reproducible. Linux is the supported +and exercised platform; other platforms are not declared supported until CI +covers them. Jenkins checks Linux on both Rust 1.98.1 (the MSRV) and current +stable, with all features and without default features. ## Quality gates @@ -15,6 +16,8 @@ cargo clippy --locked --all-targets --all-features -- -D warnings cargo test --locked --all-targets --all-features cargo test --locked --all-targets --no-default-features cargo doc --locked --no-deps --all-features +cargo audit --deny warnings +cargo deny --locked check ``` The default `fancy-diagnostics` feature enables `miette`'s rich terminal @@ -23,6 +26,12 @@ binaries remain valid without that optional renderer. Focused unit and integration tests cover domain invariants, input failures, archives, CLI exit behavior, and feature configurations. +CI runs the executable fixture manifest and Insta CLI snapshots explicitly in +addition to the full suite. `cargo-audit` rejects RustSec advisories and yanked +packages. [`deny.toml`](../deny.toml) rejects unknown dependency sources, +wildcard versions, and licenses outside the reviewed allow-list; duplicate +versions are reported for review while upstream compatibility is assessed. + Insta snapshots are reserved for stable user-facing text such as CLI help and usage errors. Structured domain values use direct assertions so failures remain precise and easy to review. Accept snapshot changes only after inspecting the diff --git a/tasks.md b/tasks.md index a6487b0..1849538 100644 --- a/tasks.md +++ b/tasks.md @@ -218,7 +218,7 @@ same config. CLI/formatter/LSP setup, exit codes, privacy, and limitations. - [x] Publish commented sample base and named configs. Document how to disable a rule/replacement and how merge-by-ID works. -- [ ] Add CI on the supported OS/MSRV matrix for formatting, Clippy, tests, docs, +- [x] Add CI on the supported OS/MSRV matrix for formatting, Clippy, tests, docs, audit/deny checks, and fixture/golden consistency. - [ ] Add fuzz targets for TOML/config merging, regex/rule loading, UTF-8 span mapping, replacement planning, and malicious ZIP metadata. Seed them with