Skip to content

CI: check dependency licences, bans and sources with cargo-deny - #276

Open
sombraSoft wants to merge 1 commit into
ivall:mainfrom
sombraSoft:ci/cargo-deny
Open

sombraSoft wants to merge 1 commit into
ivall:mainfrom
sombraSoft:ci/cargo-deny

Conversation

@sombraSoft

@sombraSoft sombraSoft commented Nov 23, 2026 •

Copy link
Copy Markdown

CONTRIBUTING.md requires every dependency to be GPL-2.0-compatible (no Apache-2.0-only, no GPL-3.0), but nothing checks it. This turns the rule into a cargo-deny check that blocks PRs. A separate workflow checks RustSec advisories daily, so a new advisory does not turn unrelated PRs red.

Part of #265

What is in it

  • deny.toml:
    • The graph is limited to x86_64-pc-windows-msvc.
    • Licence allowlist: MIT, BSD-2-Clause (retour), Unicode-3.0 (unicode-ident), and GPL-2.0-only (the workspace crates). Apache-2.0 on its own is not allowed; MIT OR Apache-2.0 crates pass through MIT.
    • Wildcard versions are denied and only crates.io is allowed. Duplicate versions only warn (windows-sys 0.52 / 0.61, syn 2 / 3).
    • Advisories: vulnerabilities, yanked, unmaintained and unsound all fail.
  • .github/workflows/ci.yml: a new deny job (ubuntu-latest, EmbarkStudios/cargo-deny-action@v2, check bans licenses sources). The header comment lists it.
  • .github/workflows/advisories.yml: check advisories runs daily, on workflow_dispatch, and on pushes / PRs that touch Cargo.lock, deny.toml or the workflow.

CI time

  • 0 wall time: the deny job runs in parallel on Ubuntu and takes 19 s. The advisories workflow (22 s) runs only daily and on PRs that change Cargo.lock, deny.toml or the workflow.

Tested

  • cargo deny check (cargo-deny 0.22.0, Windows): advisories ok, bans ok, licenses ok, sources ok, plus the 2 duplicate warnings (syn, windows-sys). Every crate's licence was checked: 50 pass through MIT, and retour, unicode-ident and the 3 workspace crates use the other entries above.
  • Fork CI: Dependencies (cargo-deny) green (https://github.com/sombraSoft/xcl/actions/runs/45276856646), Advisories green (https://github.com/sombraSoft/xcl/actions/runs/45276857241).
  • Full suite on main (9ab7d76), RTX 3060 Ti (driver 621.24), Ryzen 9 5900X, Windows 11, rustc 1.97.1, debug: scripts/test.ps1 → 651 passed, 0 failed, 40 ignored; SKIPPED: 2 (no wave64). This PR changes only CI config, so the compiled code is the same.

Regression run

  • Not needed: no crates/xcl/src change.

Not tested

  • The scheduled trigger; only the pull_request trigger ran.
  • A failing case (such as an Apache-2.0-only crate) was not tried in CI.
  • A future dependency under another GPL-2.0-compatible licence (ISC, Zlib, BSD-3-Clause, …) will need its licence added to the allowlist. That is intended: each new licence gets a look.

AI use

  • Claude Code (Claude Opus 5.5) wrote the config, the workflows and this description; I read the diff.

CONTRIBUTING.md requires every dependency to be GPL-2.0-compatible (no
Apache-2.0-only, no GPL-3.0), but nothing checked it: a new crate, or an
update that changes a crate's licence, could land unnoticed. deny.toml
turns the rule into an allowlist (BSD-2-Clause, GPL-2.0-only, MIT,
Unicode-3.0: the licences the current graph needs). Apache-2.0 is not on
it; `MIT OR Apache-2.0` crates pass through MIT. The same file refuses
wildcard versions and crates from anywhere but crates.io, and reports
duplicate versions (windows-sys 0.52 / 0.61, syn 2 / 3) without failing.

ci.yml runs `cargo deny check bans licenses sources` on Linux for every
push and pull request. RustSec advisories run in advisories.yml (daily,
by hand, and when Cargo.lock, deny.toml or that workflow changes): a new
advisory changes the result without any change to the repository and
should not turn unrelated pull requests red.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant