Files
softharbor/.gitea/workflows/ci.yml
T
poli0981andClaude Opus 5.5 20e312b851
CI / gates (push) Successful in 49s
Reusable / Security / Secrets (gitleaks) (push) Successful in 14s
Reusable / Security / Rust (cargo-deny) (push) Skipped
Reusable / Security / .NET (NuGetAudit) (push) Skipped
Reusable / Security / SAST (Opengrep) (push) Successful in 33s
Reusable / Security / Dependencies (osv-scanner) (push) Successful in 18s
Security / security (push) Successful in 1m7s
Reusable / Qodana / Qodana (push) Successful in 3m23s
Qodana / qodana (push) Successful in 3m23s
CI / build (push) Successful in 5m29s
CI / record (push) Skipped
CI / deploy (push) Successful in 1m9s
chore(deps): upkeep 2026-12-05 — 16 non-major bumps, clear six dev-tooling advisories (#11)
Dependency upkeep for 2026-12-05. Supersedes #10.

* fix(deps): update all non-major dependencies (Renovate: actions/setup-node 7.2.0, @vite-pwa/astro 2.0.5)
* chore(deps): upkeep 2026-12-05 — 16 non-major bumps, clear six dev-tooling advisories
  astro 7.4.14, svelte 5.60.1, wrangler 4.171.0, eslint 10.16.0, knip 6.51.0, prettier 3.10.2, @playwright/test 1.65.2, @astrojs/rss 4.0.20, @astrojs/sitemap 3.7.7, eslint-plugin-astro 3.2.3, svelte-eslint-parser 1.13.0, globals 17.15.0, sharp 0.35.6, @iconify-json/lucide 1.2.163, @iconify-json/simple-icons 1.2.105.
  pnpm audit / osv-scanner now clean: cross-spawn 7.1.1 (GHSA-ghv9-86vm-4v8m critical, GHSA-m6qr-m48x-3xhh, GHSA-w3gc-668g-rf8f), ws >= 8.23.0 (GHSA-37g9-w4hg-h9qr), minimatch 11.0.10 (GHSA-3924-r96c-gp9w), terser gone from the lockfile (GHSA-6jpm-p5cq-9q44). All build/dev tooling; no override added.
* fix(e2e): size the Playwright pool by the container's CPU quota
  The ubuntu jobs moved to runner anon-docker (2026-12-04, `--cpus=4`), but os.cpus() reports the host's 28 cores, so 14 workers shared four CPUs and the axe tests timed out — main failed the same way (dispatched run 1565). playwright.config.ts reads /sys/fs/cgroup/cpu.max; no quota keeps Playwright's default.

No release: routine upkeep (docs/13 §1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 03:36:07 +00:00

280 lines
13 KiB
YAML

# docs/12 §2 — self-contained, deliberately.
#
# It once called `poli0981/.github` → `reusable-web-react.yml`, which ran
# lint / typecheck / test only *if a matching package script existed* — rename
# a script and CI quietly stops checking while still going green. This
# project's gates ARE the product, and it has shipped silent no-ops before (a
# dead set:html lint rule, workbox globs matching nothing, an unregistered
# service worker, CSP-dropped inline styles). The duplicated "logic" is a
# handful of pnpm invocations: a fair price for a gate that fails loudly.
#
# Gitea Actions since 2026-11-24 (D38, runbook `docs/GITEA-MIGRATION.md` in
# poli0981/.github): one runner on the maintainer's PC, jobs in Docker
# (`docker.gitea.com/runner-images`, as root). Branch protection on `main`
# requires `CI / build (*)` and `CI / gates (*)` — Gitea names a check
# `<workflow> / <job> (<event>)`, so renaming either breaks the rule.
#
# Every `uses:` is pinned to a full commit SHA with the release in a comment;
# Renovate (renovate.json) bumps both together.
name: CI
on:
pull_request:
push:
branches: [main]
# How the bots' pull requests get their checks: an event caused by the job
# token starts no workflow, so quarantine.yml and vt-recheck.yml dispatch
# this one on their branch, and `record` below turns the dispatched run's
# results into the statuses protection asks for (docs/12 §4).
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# No `version:` — the action reads package.json `packageManager`, so CI
# and laptops run the same pnpm.
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Lint & format
run: pnpm lint
- name: Types
run: pnpm check
# `coverage` IS the unit run (vitest run --coverage): one pass, and it
# fails below the thresholds in vitest.config.ts.
- name: Unit tests (with coverage thresholds)
run: pnpm coverage
# `pnpm build` is the SAME command the `deploy` job runs, and it carries
# its own gates: data + i18n before `astro build`, the CSP, asset,
# service-worker and feed checks on dist/ after it (package.json).
- name: Build (with data, i18n, CSP and service-worker gates)
run: pnpm build
# Bundles worker/ and validates wrangler.jsonc (bindings, assets,
# run_worker_first) exactly as a deploy would, without credentials. A
# config error then fails here instead of in production.
- name: Worker bundle (wrangler deploy --dry-run)
env:
WRANGLER_SEND_METRICS: 'false'
run: pnpm exec wrangler deploy --dry-run --outdir "$RUNNER_TEMP/worker"
- name: Dead code
run: pnpm knip
# End-to-end on the build above (docs/11): every page type in both
# locales and colour schemes, desktop + mobile, failing on any console
# error, CSP violation or axe finding. The browser download is ~150 MB
# and versioned with @playwright/test, so it is cached per version; on a
# hit only the OS libraries still need installing. The servers bind
# 127.0.0.1 explicitly (playwright.config.ts): in the job container
# `localhost` can resolve to ::1 for a server and 127.0.0.1 for a client.
- name: Playwright version
id: pw
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: pw-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}
- name: Install Chromium
if: steps.pw-cache.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps chromium
- name: Install Chromium system libraries
if: steps.pw-cache.outputs.cache-hit == 'true'
run: pnpm exec playwright install-deps chromium
- name: End-to-end (Playwright + axe on the built site)
run: pnpm e2e
# The route from the runner to the server's artifact store has dropped
# uploads mid-way (ticktune, 2026-11-23): a lost report must never turn
# a red run into a confusing one.
- name: Keep the Playwright report
if: failure()
continue-on-error: true
uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7
gates:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
env:
OSV_SCANNER_VERSION: v2.7.1
OSV_SCANNER_SHA256: fb7dab19a8bd9bbe5c3189f09d4b7ee1820c9553a23bac202648a56efd2f6ee8 # osv-scanner_linux_amd64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # the changed-links step diffs against the PR base
persist-credentials: false
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Data rules (L2)
run: pnpm validate:data
- name: EN/VI key parity (hard rule 6)
run: pnpm i18n:check
# The same pinned, checksum-verified binary the ops repo's security.yml
# runs, here because this gate is REQUIRED: an advisory against the
# lockfile blocks the merge (docs/09 §7). osv-scanner.toml, beside the
# lockfile, holds the time-boxed exceptions. Renovate does not see this
# pin: bump version and checksum together, by hand.
- name: Install osv-scanner ${{ env.OSV_SCANNER_VERSION }}
run: |
set -euo pipefail
bin="$RUNNER_TEMP/osv-scanner/osv-scanner"
mkdir -p "$(dirname "$bin")"
curl --proto '=https' -fsSL --retry 3 -o "$bin" \
"https://github.com/google/osv-scanner/releases/download/${OSV_SCANNER_VERSION}/osv-scanner_linux_amd64"
echo "${OSV_SCANNER_SHA256} $bin" | sha256sum -c -
chmod +x "$bin"
echo "$RUNNER_TEMP/osv-scanner" >> "$GITHUB_PATH"
- name: Vulnerability scan
run: osv-scanner scan source --lockfile=pnpm-lock.yaml
- name: Audit production deps
run: pnpm audit --prod
# PR-time link check over the links a PR adds or edits — the URLs on the
# diff's added lines — not every link in every touched file: a re-check
# PR that rewrote 198 security blocks once had to re-verify ~700
# unrelated vendor links, and one vendor's bad minute blocked it.
# link-check.yml owns the weekly full sweep (docs/12 §5). git runs HERE,
# under pipefail, so a failed diff stops the job instead of silently
# narrowing the check.
- name: Collect changed official links
id: urls
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
git diff -U0 "origin/${BASE_REF}...HEAD" -- src/data/apps \
| node scripts/extract-urls.mjs --added > /tmp/urls.txt
count=$(grep -c . /tmp/urls.txt || true)
echo "count=$count" >> "$GITHUB_OUTPUT"
echo "$count changed URL(s) to check"
# Accepting 403/429 is about bot mitigation, not about being lenient.
# Seeding the catalogue put ~1 150 vendor URLs through here and 14 came
# back 403 from sites that are plainly alive (winehq.org, dolphin-emu.org,
# rpcs3.net, gitlab.com, MSI, Nexus Mods, Epic, Enpass). A checker that
# cries wolf on a seventh of the catalogue teaches everyone to ignore it.
# 404/500/connection failures — the codes that actually mean "gone" —
# still fail the build.
#
# Do NOT add `--user-agent`: spoofing a browser cleared the 403s but made
# gitlab.gnome.org answer 406 and whatsapp.com 400, both of which pass on
# lychee's default agent.
#
# Skipped when the PR changes no app data — lychee treats an empty input
# as a configuration error. A skipped step is visible in the run, where a
# green "0 links" would be exactly the kind of quiet pass this repo keeps
# getting caught by.
- name: Link check
if: github.event_name == 'pull_request' && steps.urls.outputs.count != '0'
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
with:
args: >-
--max-concurrency 4 --retry-wait-time 5 --max-retries 4 --timeout 45
--accept '200..=299,403,429'
/tmp/urls.txt
# A dispatched run writes no commit status on Gitea 28.4 (runbook §6), so a
# bot PR whose checks came from `workflow_dispatch` would never meet the
# protection rule. This job records build's and gates' results on the
# commit under the names the rule matches (`CI / build (*)`).
record:
needs: [build, gates]
if: always() && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write # commit statuses
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
with:
node-version-file: .nvmrc
- name: Record build and gates as commit statuses
env:
GITEA_API: ${{ github.api_url }}
GITEA_REPO: ${{ github.repository }}
GITEA_TOKEN: ${{ github.token }}
SHA: ${{ github.sha }}
BUILD: ${{ needs.build.result }}
GATES: ${{ needs.gates.result }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
node scripts/gitea.mjs status "$SHA" 'CI / build (workflow_dispatch)' "$BUILD" "$RUN_URL"
node scripts/gitea.mjs status "$SHA" 'CI / gates (workflow_dispatch)' "$GATES" "$RUN_URL"
# D38 — production deploys from here. Cloudflare Workers Builds pulled from
# the GitHub repository and stopped with it; nothing else deploys, and pull
# requests get no preview versions (the Cloudflare token stays out of every
# job a branch can run). CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID are
# user-level Gitea Actions secrets. The Worker's runtime secret
# (TURNSTILE_SECRET) lives on the Worker and survives a deploy.
deploy:
needs: [build, gates]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
WRANGLER_SEND_METRICS: 'false'
run: pnpm exec wrangler deploy --message "main ${GITHUB_SHA:0:7}"
# /api/apps.json carries the build's own timestamp: production serves
# THIS build once it answers with the one in dist/. The query string
# skips any cached copy (the file is cached for 5 minutes, _headers).
- name: Live
run: |
want=$(node -p "require('./dist/api/apps.json').generatedAt")
for i in $(seq 1 30); do
live=$(curl -fsS "https://softharbor.net/api/apps.json?deploy=${GITHUB_SHA}" \
| node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{console.log(JSON.parse(s).generatedAt)}catch{console.log("")}})' || true)
if [ "$live" = "$want" ]; then echo "live: $live"; exit 0; fi
sleep 5
done
echo "::error::production still serves ${live:-nothing}, not this build's $want"
exit 1