Files
youtube-generator/.github/workflows/rust.yml
T
poli0981andClaude Opus 5.5 a70580e703 ci: security, licensing and style gates; pin every action by SHA
New checks
- security.yml: dependency-review blocks PRs that add a high/critical
  advisory; actionlint + zizmor lint the workflows themselves (template
  injection, permissions, credential persistence, unpinned uses); OpenSSF
  Scorecard weekly and on main (published, not uploaded as alerts).
- compliance.yml: REUSE lint over the whole repo (REUSE.toml + LICENSES/,
  no per-file headers) and Conventional-Commit PR titles.
- rust.yml (src-tauri changes + weekly): rustfmt, clippy -D warnings,
  cargo test, and cargo-deny for RustSec advisories, licenses and sources.
- ci.yml `check` gains: coverage thresholds (src/engine, worker),
  check:licenses, check:bundle, and a `wrangler deploy --dry-run`.

Licensing
- THIRD_PARTY_NOTICES.md is now generated from package.json, the installed
  packages and Cargo.toml/Cargo.lock (`npm run generate:third-party`); CI
  fails when it is stale or when anything bundled into the app carries a
  license outside the allowlist. It had drifted to React 18 / Vite 7 /
  Tailwind 3.
- Vite's build.license emits the full text of every bundled package's
  license to /licenses/third-party.md (served publicly, before the gate).

Bundle budget
- scripts/check-bundle-size.ts measures what CLAUDE.md's "500KB" never
  defined: initial load (everything index.html references) <= 280 KB gzip
  (197 KB today) and no JS chunk over 500 KB raw.

Coverage
- @vitest/coverage-v8; thresholds sit just under today's numbers. The
  engine is at 89% lines / 64% functions — not the 100% CLAUDE.md claimed.

Supply chain
- Every third-party action pinned to a commit SHA (Dependabot updates the
  SHA and its version comment); checkout never persists credentials.
- Release workflows: a `verify` job (typecheck, tests, version sync, Tauri
  alignment, tag == package version) gates the build; no dependency caches
  in release jobs; permissions granted per job.
- Reusable Discord workflows receive only the secrets they declare instead
  of `secrets: inherit` (which exposed the Android signing keys to them).
- Rust: cargo-deny found RUSTSEC-2026-0194/0195 (quick-xml DoS, via plist)
  that Dependabot had not raised; plist 1.10 brings quick-xml 0.41.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 19:46:24 +07:00

76 lines
2.4 KiB
YAML

name: Rust
# The Tauri shell changes rarely, so this only runs when it does (or weekly,
# to catch new RustSec advisories). Not a required check for that reason.
on:
pull_request:
branches: [main]
paths:
- "src-tauri/**"
- ".github/workflows/rust.yml"
push:
branches: [main]
paths:
- "src-tauri/**"
- ".github/workflows/rust.yml"
schedule:
- cron: "41 4 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: rust-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev \
libayatana-appindicator3-dev librsvg2-dev patchelf
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
workspaces: src-tauri
# tauri::generate_context!() embeds the frontend at compile time, so
# clippy and the tests need a built dist/.
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run build
- name: rustfmt
working-directory: src-tauri
run: cargo fmt --all -- --check
- name: clippy
working-directory: src-tauri
run: cargo clippy --all-targets --locked -- -D warnings
- name: test
working-directory: src-tauri
run: cargo test --locked
# RustSec advisories, license allowlist, duplicate/banned crates and
# registry sources for the whole crate tree (src-tauri/deny.toml).
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
manifest-path: src-tauri/Cargo.toml
command: check advisories licenses sources