build: add a license gate for shipped npm packages and Rust crates (P2.3)

scripts/check-licenses.mjs (npm run check:licenses) reads the production
dependency closures of the sidecar (@waggle/server minus the packages
stage-sidecar-deps.mjs never ships) and the web UI (apps/web) from
package-lock.json and fails on GPL, AGPL, SSPL, missing and unknown
licenses. It allows permissive licenses plus MPL-2.0 and lists named
exceptions with reasons; LGPL libvips and node-webpmux, the OFL fonts and
the unlicensed buffers package are marked as pending the licensing review.

app/src-tauri/deny.toml applies the same allowlist to the Tauri crates with
cargo-deny; the npm check fails when the two lists drift apart. A new CI
job runs both, with cargo-deny 0.18.3 installed and cached in CI.

scripts/license-inventory.mjs holds the shared closure logic.
This commit is contained in:
shumeiko.it
2026-11-01 00:30:06 +01:00
parent 5a7f3d24d9
commit 3ebe97e033
6 changed files with 720 additions and 0 deletions

View File

@@ -91,6 +91,38 @@ jobs:
run: npm audit --audit-level=high
continue-on-error: true
# License gate (P2.3). The npm check reads the shipped closures from
# package-lock.json, so it needs no install. cargo-deny checks the crates of
# the desktop shell against app/src-tauri/deny.toml; it is pinned, cached,
# and fetches the crates itself.
licenses:
runs-on: ubuntu-latest
env:
CARGO_DENY_VERSION: 0.18.3
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.23.2
- name: Licenses — shipped npm packages
run: npm run check:licenses
- name: Cache cargo-deny
id: cargo-deny-cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-deny
key: ${{ runner.os }}-cargo-deny-${{ env.CARGO_DENY_VERSION }}
- name: Install cargo-deny
if: steps.cargo-deny-cache.outputs.cache-hit != 'true'
run: cargo install cargo-deny --locked --version "$CARGO_DENY_VERSION"
- name: Licenses — Rust crates (cargo-deny)
run: cargo deny --manifest-path app/src-tauri/Cargo.toml check licenses
# ADVISORY / NON-BLOCKING. `continue-on-error: true` means a red e2e run does
# NOT block merges — by design. These specs are broad product/audit journeys
# (full-product-audit, power-user-stress, competitive-benchmarks, …) that are