Files
jsonPrism/.github/workflows/ci.yml
T
poli0981andClaude Opus 5.5 532b5cfd82 JSONPrism 2.0.0: Cloudflare Workers, TypeScript 7 and a full audit (#151)
- Web app moves to https://jsonprism.poli0981.dev on Cloudflare Workers
  (static assets + /api/turnstile/verify + /api/health), with security
  headers, redirects for the old /jsonPrism paths, previews for
  non-production branches and a production smoke workflow. GitHub Pages
  only redirects now.
- Web-only Turnstile human check (server-verified, 7-day pass) and
  cookieless Web Analytics (after consent, opt-out, off under GPC);
  Privacy Policy and Terms 2.0, consent version 2.
- Node 26, TypeScript 7 with the TS 6 API alias for typescript-eslint,
  dependencies on current majors (ends the ERESOLVE that kept main red).
- Converter fixes: CSV columns, binary ZIP entries, MySQL backslash
  escaping, RESX/XML validity, BSON size, YAML quoting and alias limits,
  TOML nulls and big integers, JSON error positions, JSONL/BOM linting.
- Web Worker conversion, faster editor, technical UI refresh with an
  Appearance menu and custom scrollbars, accessibility and i18n gaps.
- Tauri least-privilege capabilities, hardened CSP, Tauri 2.12.
- CI: SHA-pinned least-privilege workflows, SonarQube Cloud, Rust job,
  verifiable releases (SHA256SUMS + provenance); Dependabot grouping.
- 864 tests (97% line coverage), SonarCloud quality gate passing; docs,
  legal and CLAUDE.md refreshed.

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

170 lines
4.7 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions: {}
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
# Only superseded PR runs are cancelled; every commit on main gets a full run.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
WRANGLER_SEND_METRICS: 'false'
jobs:
web:
name: Web · lint, typecheck, test, build
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
# No dependency needs its install scripts (esbuild, workerd and the Tauri
# CLI resolve their platform binaries at runtime), so none get to run.
- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --no-fund
- name: Format check
run: npm run format:check
- name: Lint
run: npm run lint
- name: Knip
run: npm run knip
- name: Typecheck (TypeScript 7)
run: |
npx tsc --version | grep -q '^Version 7\.' || { echo "::error::tsc is not TypeScript 7"; exit 1; }
npm run typecheck
- name: Test with coverage
run: npm run test:coverage
- name: Build
run: npm run build
- name: Worker deploy dry run
run: npm run cf:check
- name: Upload dist
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist
retention-days: 7
- name: Upload coverage
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coverage
path: coverage/lcov.info
retention-days: 7
sonar:
name: SonarQube Cloud
needs: web
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
env:
# Empty for Dependabot and fork PRs, which get no secrets: skip, don't fail.
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Skip without a token
if: env.SONAR_TOKEN == ''
run: echo "::notice::SONAR_TOKEN is not available to this run; skipping analysis."
- name: Checkout
if: env.SONAR_TOKEN != ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Full history so new-code detection and blame work.
fetch-depth: 0
persist-credentials: false
- name: Download coverage
if: env.SONAR_TOKEN != ''
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: coverage
path: coverage
- name: Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0
rust:
name: Tauri · fmt, clippy
needs: web
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libgtk-3-dev
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --no-fund
# generate_context!() embeds the icons and the built frontend at compile time.
- name: Generate icons
run: npm run tauri:icon
- name: Download dist
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist
- name: Setup Rust
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: stable
components: clippy, rustfmt
- name: Cache Cargo
uses: swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
workspaces: './src-tauri -> target'
- name: rustfmt
working-directory: src-tauri
run: cargo fmt --check
- name: Clippy
working-directory: src-tauri
run: cargo clippy --all-targets --locked -- -D warnings