Files
youtube-generator/.github/workflows/ci.yml
T
poli0981andClaude Opus 5.5 ad523ea0fb chore(typescript): move to TypeScript 7 with an ES2025 target
TypeScript 7.0 is the native compiler and ships no JavaScript API, which
typescript-eslint still needs. Install both, as Microsoft documents it:
- "@typescript/native": "npm:typescript@^7.0.2" gives `tsc` = 7.0
- "typescript": "npm:@typescript/typescript6@^6.0.2" gives the 6.0 API
  that typescript-eslint loads (its peer range stops below 6.1), and `tsc6`
CI fails if `tsc` ever resolves to TypeScript 6 (@typescript/old, pulled in
by the 6.0 package, ships a `tsc` too).

tsconfig.json (src):
- target ES2025: the newest year TypeScript 7.0, esbuild and Vite all know
- lib ES2022 + DOM: the browser floor (Vite's baseline-widely-available,
  Chrome 111 / Safari 16.4 / Firefox 114), because nothing polyfills
- baseUrl removed (gone in 7.0; paths were already relative), DOM.Iterable
  dropped (merged into DOM), `types: []` spelled out, erasableSyntaxOnly and
  verbatimModuleSyntax on (both clean)
tsconfig.check.json: lib ES2025 for tests, scripts, worker and build plugins.

Platform floor: the Tauri build no longer lowers to es2020; it shares the
web build's baseline (the stylesheet already needed Chromium 99+ /
Safari 15.4+). macOS minimumSystemVersion is 11.0 (the build is arm64).

Also: eslint.config.js uses ESLint's defineConfig (tseslint.config is
deprecated); THIRD_PARTY_NOTICES names the real package behind an npm
alias, sorted with a shared code-unit comparator (src/utils/sort.ts);
Dependabot groups typescript + @typescript/*; a test's typed-array
annotation follows TypeScript 7's lib.dom.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 14:48:21 +07:00

104 lines
4.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Least privilege. The job only reads the repo — it publishes nothing, comments
# nowhere. Declaring it explicitly also silences CodeQL's
# `actions/missing-workflow-permissions`, which otherwise flags the implicit
# (and much wider) default token scope.
permissions:
contents: read
# A force-push or a quick follow-up commit makes the older run worthless. Cancel
# it instead of paying for both — except on `main`, where every commit's result
# is a historical record the release process reads back.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
# `check` is the required status on `main` (ruleset "main-protection") — keep
# the job id stable.
check:
runs-on: ubuntu-latest
steps:
# Actions are pinned by commit SHA (a tag can be moved; a SHA cannot).
# Dependabot keeps the SHA and the version comment up to date.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
- run: npm ci
# `tsc` must be TypeScript 7 (@typescript/native). The `typescript` alias
# (@typescript/typescript6, the API typescript-eslint loads) pulls in
# TypeScript 6 as @typescript/old, which ships a `tsc` too — npm links the
# first one by path order. Fail loudly if that ever flips, instead of
# silently type-checking with 6.
- name: TypeScript 7 is the `tsc` on PATH
run: ./node_modules/.bin/tsc --version | grep -q '^Version 7\.'
# --- correctness ------------------------------------------------------
# `typecheck` covers src/ (what Vite builds); `typecheck:all` adds tests/,
# scripts/, worker/ and build-plugins/.
- name: Type check (src)
run: npm run typecheck
- name: Type check (tests, scripts, worker, build plugins)
run: npm run typecheck:all
- name: Lint
run: npm run lint
- name: Validate locales
run: npm run validate:locales
# Coverage thresholds for src/engine and worker live in vitest.config.ts.
- name: Test (with coverage thresholds)
run: npm run test:coverage
# --- consistency ------------------------------------------------------
- name: Check formatting
run: npm run format:check
- name: Check dead code
run: npm run knip
# The release ritual bumps SIX version fields by hand. This is the only
# thing that notices when one is missed — see scripts/check-version-sync.ts.
- name: Check version sync
run: npm run check:version
# tauri build refuses mismatched npm/crate minors, and CI never runs it.
- name: Check Tauri npm/crate alignment
run: npm run check:tauri
# --- licensing --------------------------------------------------------
# Every package bundled into the app has an allowed license, and
# THIRD_PARTY_NOTICES.md matches what is actually installed.
- name: Check licenses and third-party notices
run: npm run check:licenses
# NOTICE, REUSE.toml and the installers' copyright string state the
# years ("2026", later "2026-2027"). The first commit in a new year
# fails here until `npm run update:copyright` extends them.
- name: Check copyright years
run: npm run check:copyright
# --- security ---------------------------------------------------------
# Advisory-only: a fresh high-severity advisory in a transitive dep must
# not turn every unrelated PR red before Dependabot has had a chance to
# open its fix PR. The Dependabot alerts tab is the source of truth, and
# dependency-review (security.yml) blocks PRs that *introduce* one.
- name: Audit dependencies
run: npm audit --audit-level=high
continue-on-error: true
# --- build ------------------------------------------------------------
- name: Build
run: npm run build
- name: Check bundle budget
run: npm run check:bundle
# Validates wrangler.jsonc and bundles the Worker exactly as Workers
# Builds will — without deploying anything.
- name: Dry-run the Cloudflare deploy
run: npx wrangler deploy --dry-run --outdir .wrangler/dry-run