ci(sonar): analyse in GitHub Actions with test coverage (#157)
SonarQube Cloud analyses in GitHub Actions instead of Automatic Analysis, with test coverage (sonarcloud.yml): token (skips Dependabot and fork PRs, which get no SONAR_TOKEN) → coverage (pytest-cov and Vitest v8, no secrets) → scan (sonarqube-scan-action v8.3.0, full history, sonar.projectVersion from webapp/package.json). sonar-project.properties replaces .sonarcloud.properties: tests marked as tests, coverage exclusions for code without unit tests by design, Python 3.14 (the analyzer has no 3.15 yet), binary images and the SQLite migrations (claimed by the PL/SQL analyzer, which only warned) left out. Adds pytest-cov / coverage (dev lock recompiled on Python 3.14) and @vitest/coverage-v8 (Dependabot group with vitest). Docs: CLAUDE.md gotcha 41, THIRD_PARTY, dev_env, CONTRIBUTING (EN + VI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
43663e4220
commit
40b17e620d
18 files changed
+487
-16
No files matched your search
@@ -21,6 +21,9 @@ updates:
|
|||||||
patterns: ['@radix-ui/*', 'radix-ui']
|
patterns: ['@radix-ui/*', 'radix-ui']
|
||||||
tauri-js:
|
tauri-js:
|
||||||
patterns: ['@tauri-apps/*']
|
patterns: ['@tauri-apps/*']
|
||||||
|
# @vitest/coverage-v8 requires the exact vitest version (peer dependency).
|
||||||
|
vitest:
|
||||||
|
patterns: ['vitest', '@vitest/*']
|
||||||
build-tooling:
|
build-tooling:
|
||||||
patterns:
|
patterns:
|
||||||
- 'vite'
|
- 'vite'
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
# SonarQube Cloud: CI-based analysis with test coverage
|
||||||
|
# (https://sonarcloud.io/project/overview?id=poli0981_free-games-itchio-list).
|
||||||
|
# Automatic Analysis is switched off on sonarcloud.io — while it is on, the
|
||||||
|
# scanner refuses to run. Settings: sonar-project.properties. The SonarQube
|
||||||
|
# Cloud app reports each PR's quality gate as the "SonarCloud Code Analysis" check.
|
||||||
|
#
|
||||||
|
# token — is SONAR_TOKEN available? Dependabot and fork PRs get no
|
||||||
|
# repository secrets: the analysis is skipped there, not failed.
|
||||||
|
# coverage — pytest-cov and Vitest (v8) coverage reports, without the token.
|
||||||
|
# scan — sonarqube-scan-action with those reports: the only step that
|
||||||
|
# uses the token, in a job that runs no project or dependency code.
|
||||||
|
name: SonarQube Cloud
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
# Data commits (the pipeline's, the admin Worker's) and docs change no code.
|
||||||
|
paths-ignore:
|
||||||
|
- 'data_game/**'
|
||||||
|
- 'scripts/temp_link.json'
|
||||||
|
- 'scripts/deleted_games.json'
|
||||||
|
- 'scripts/state/**'
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'data_game/**'
|
||||||
|
- 'scripts/temp_link.json'
|
||||||
|
- 'scripts/deleted_games.json'
|
||||||
|
- 'scripts/state/**'
|
||||||
|
- '**.md'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: sonarcloud-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
token:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
permissions: {}
|
||||||
|
outputs:
|
||||||
|
present: ${{ steps.check.outputs.present }}
|
||||||
|
steps:
|
||||||
|
- name: Check for SONAR_TOKEN
|
||||||
|
id: check
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [ -n "$SONAR_TOKEN" ]; then
|
||||||
|
echo "present=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "::notice::No SONAR_TOKEN in this run (Dependabot or fork PR): SonarQube Cloud analysis skipped."
|
||||||
|
fi
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
needs: token
|
||||||
|
if: needs.token.outputs.present == 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||||
|
with:
|
||||||
|
python-version-file: .github/python-version
|
||||||
|
cache: pip
|
||||||
|
cache-dependency-path: |
|
||||||
|
requirements.txt
|
||||||
|
requirements-dev.txt
|
||||||
|
|
||||||
|
# Hash-locked, wheels only (CLAUDE.md, gotcha 40).
|
||||||
|
- name: Install Python dependencies
|
||||||
|
run: |
|
||||||
|
pip install --require-hashes --only-binary :all: -r requirements.txt -r requirements-dev.txt
|
||||||
|
|
||||||
|
- name: Pytest with coverage
|
||||||
|
run: pytest --cov --cov-report=xml
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||||
|
with:
|
||||||
|
node-version-file: webapp/.node-version
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: webapp/package-lock.json
|
||||||
|
|
||||||
|
- name: Install npm dependencies
|
||||||
|
working-directory: webapp
|
||||||
|
run: npm ci --ignore-scripts
|
||||||
|
|
||||||
|
- name: Vitest with coverage
|
||||||
|
working-directory: webapp
|
||||||
|
run: npm run test:coverage
|
||||||
|
|
||||||
|
- name: Upload coverage reports
|
||||||
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
|
with:
|
||||||
|
name: coverage
|
||||||
|
path: |
|
||||||
|
coverage.xml
|
||||||
|
webapp/coverage/lcov.info
|
||||||
|
retention-days: 1
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
scan:
|
||||||
|
needs: coverage
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
# Full history: blame data, and the new-code diff of a PR.
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Download coverage reports
|
||||||
|
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||||
|
with:
|
||||||
|
name: coverage
|
||||||
|
|
||||||
|
# The app version is the analysis version, so on main "new code" (New Code
|
||||||
|
# definition: previous version) starts over at each version bump.
|
||||||
|
- name: Read the app version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
version=$(jq -r .version webapp/package.json)
|
||||||
|
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "::error::webapp/package.json has no x.y.z version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: SonarQube Cloud scan
|
||||||
|
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: -Dsonar.projectVersion=${{ steps.version.outputs.version }}
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
/webapp/node_modules/
|
/webapp/node_modules/
|
||||||
/webapp/dist/
|
/webapp/dist/
|
||||||
|
/webapp/coverage/
|
||||||
/webapp/src-tauri/target/
|
/webapp/src-tauri/target/
|
||||||
/webapp/src-tauri/gen/
|
/webapp/src-tauri/gen/
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# SonarQube Cloud automatic analysis
|
|
||||||
# (https://sonarcloud.io/project/overview?id=poli0981_free-games-itchio-list).
|
|
||||||
# Automatic analysis reads only a few settings from this file (no per-rule ignores):
|
|
||||||
# mark a false positive on the issue itself. See CLAUDE.md, gotcha 41.
|
|
||||||
|
|
||||||
# itch.io pages saved as served, for the scraper tests: their markup is
|
|
||||||
# itch.io's (tables without <th>, tabindex on divs, …), and editing it would
|
|
||||||
# make the tests check something itch.io never sends.
|
|
||||||
sonar.exclusions=tests/fixtures/**
|
|
||||||
@@ -10,7 +10,7 @@ everyone; the old github.io URL only redirects). Three layers share one JSON cat
|
|||||||
1. **Python pipeline** — the data layer (GitHub Actions).
|
1. **Python pipeline** — the data layer (GitHub Actions).
|
||||||
- `data_game/game_info_NNN.json` — chunked records, max 500 per file, 3,251 games on 2026-10-10. Serialization is fixed: `json.dumps(..., ensure_ascii=False, indent=4)`, no trailing newline (`json_io.dumps`) — the Worker port (`webapp/worker/catalog.ts`) emits identical bytes (`tests/fixtures/golden/`).
|
- `data_game/game_info_NNN.json` — chunked records, max 500 per file, 3,251 games on 2026-10-10. Serialization is fixed: `json.dumps(..., ensure_ascii=False, indent=4)`, no trailing newline (`json_io.dumps`) — the Worker port (`webapp/worker/catalog.ts`) emits identical bytes (`tests/fixtures/golden/`).
|
||||||
- `data_game/index.json` — chunk manifest (total + per-file counts). `data_game/count_history.json` — date-keyed `{date,total}` series ("games over time" chart). `scripts/deleted_games.json` — removal log (public "Removed" page). `scripts/temp_link.json` — ingest queue.
|
- `data_game/index.json` — chunk manifest (total + per-file counts). `data_game/count_history.json` — date-keyed `{date,total}` series ("games over time" chart). `scripts/deleted_games.json` — removal log (public "Removed" page). `scripts/temp_link.json` — ingest queue.
|
||||||
- `scripts/` — scanners never write the catalog: `update_info.py` (queued URLs) and `refresh.py` (rotating 1/7-per-day check; `--full` re-scrape) emit a URL-keyed **patch** (`patch.py`); `apply_patch.py` applies it to the latest `main` and runs `validate.py`; `bash/commit_push.sh` does fetch → reset → apply → commit → push with retries. Shared: `scraper.py` (session, `Pacer` + 429 back-off, parsing: the info panel incl. itch.io's 2025–26 rows — `AI Disclosure` ("AI Assisted", then what for) / `Content` linking `/games/tag-no-ai` → `ai_disclosure` + `ai_content`, `Accessibility` → `accessibility`; `description` = the creator's tagline (`og:description`), else the first sentence), `data_store.py` (chunks stay in place, rebalance only past thresholds, write-if-changed), `json_io.py`, `canonical.py` (canonical itch.io URL; vectors in `tests/fixtures/url_vectors.json`, shared with the Worker). Pipeline bookkeeping lives in `scripts/state/` (not published), including `ingest_outcomes.json` (how each queued link ended — added / duplicate / paid / dead / private / deleted / gave_up; patch key `ingest_outcomes`; the last 90 days, ≤ 5,000) that the admin's tracking and the cron's reconcile read. Tests: `pytest` (network blocked). Lint: `ruff check scripts tests webapp/scripts`, `ruff format`, `vulture` (config in root `pyproject.toml`). Local env: Python 3.15 (`.github/python-version`, gotcha 39; ruff `target-version = "py315"`), `python -m venv .venv && .venv/Scripts/pip install -r requirements-dev.txt` (3.15 is in UTF-8 mode by default — no `PYTHONUTF8` needed, the workflows no longer set it). Both requirements files are hash-locked pip-tools compiles of `requirements*.in` — edit the `.in`, then recompile (gotcha 40).
|
- `scripts/` — scanners never write the catalog: `update_info.py` (queued URLs) and `refresh.py` (rotating 1/7-per-day check; `--full` re-scrape) emit a URL-keyed **patch** (`patch.py`); `apply_patch.py` applies it to the latest `main` and runs `validate.py`; `bash/commit_push.sh` does fetch → reset → apply → commit → push with retries. Shared: `scraper.py` (session, `Pacer` + 429 back-off, parsing: the info panel incl. itch.io's 2025–26 rows — `AI Disclosure` ("AI Assisted", then what for) / `Content` linking `/games/tag-no-ai` → `ai_disclosure` + `ai_content`, `Accessibility` → `accessibility`; `description` = the creator's tagline (`og:description`), else the first sentence), `data_store.py` (chunks stay in place, rebalance only past thresholds, write-if-changed), `json_io.py`, `canonical.py` (canonical itch.io URL; vectors in `tests/fixtures/url_vectors.json`, shared with the Worker). Pipeline bookkeeping lives in `scripts/state/` (not published), including `ingest_outcomes.json` (how each queued link ended — added / duplicate / paid / dead / private / deleted / gave_up; patch key `ingest_outcomes`; the last 90 days, ≤ 5,000) that the admin's tracking and the cron's reconcile read. Tests: `pytest` (network blocked; `pytest --cov --cov-report=xml` → `coverage.xml` for SonarQube Cloud, gotcha 41). Lint: `ruff check scripts tests webapp/scripts`, `ruff format`, `vulture` (config in root `pyproject.toml`). Local env: Python 3.15 (`.github/python-version`, gotcha 39; ruff `target-version = "py315"`), `python -m venv .venv && .venv/Scripts/pip install -r requirements-dev.txt` (3.15 is in UTF-8 mode by default — no `PYTHONUTF8` needed, the workflows no longer set it). Both requirements files are hash-locked pip-tools compiles of `requirements*.in` — edit the `.in`, then recompile (gotcha 40).
|
||||||
2. **Cloudflare Worker + static assets** — `webapp/worker/` + `webapp/wrangler.jsonc`, deployed by **Cloudflare Workers Builds** from `main` (root dir `webapp`, build `npm run build`, deploy `npx wrangler deploy`; no deploy workflow). The catalog is bundled into the site at build time (`vite-plugins/catalog-data.ts` → `dist/data/pack/` compact packs + the legacy readable JSON in `dist/data/`, plus `data/urls.json` and `sitemap.xml`), so every data commit rebuilds the site.
|
2. **Cloudflare Worker + static assets** — `webapp/worker/` + `webapp/wrangler.jsonc`, deployed by **Cloudflare Workers Builds** from `main` (root dir `webapp`, build `npm run build`, deploy `npx wrangler deploy`; no deploy workflow). The catalog is bundled into the site at build time (`vite-plugins/catalog-data.ts` → `dist/data/pack/` compact packs + the legacy readable JSON in `dist/data/`, plus `data/urls.json` and `sitemap.xml`), so every data commit rebuilds the site.
|
||||||
3. **Web app + Tauri apps** — `webapp/src/` (React 19.3 + TypeScript 7.0 + Vite 8/rolldown + Tailwind + shadcn/ui + React Router 8), and the **Tauri 2 desktop + Android** read-only viewers in `webapp/src-tauri/` (same code; they fetch `https://freeitchgames.win/data/pack` and load covers straight from img.itch.zone). Plus `webapp/admin/` — the maintainer-only admin app (second Vite entry, served at `/admin/`).
|
3. **Web app + Tauri apps** — `webapp/src/` (React 19.3 + TypeScript 7.0 + Vite 8/rolldown + Tailwind + shadcn/ui + React Router 8), and the **Tauri 2 desktop + Android** read-only viewers in `webapp/src-tauri/` (same code; they fetch `https://freeitchgames.win/data/pack` and load covers straight from img.itch.zone). Plus `webapp/admin/` — the maintainer-only admin app (second Vite entry, served at `/admin/`).
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ npm run dev # Vite on http://localhost:5173 (proxies /api and /img to
|
|||||||
npx wrangler dev # the Worker + built assets (run `npm run build` first); .dev.vars holds local secrets
|
npx wrangler dev # the Worker + built assets (run `npm run build` first); .dev.vars holds local secrets
|
||||||
npm run build # → webapp/dist/ (public app + /admin/ + /data + sitemap); Tauri builds use the same dir
|
npm run build # → webapp/dist/ (public app + /admin/ + /data + sitemap); Tauri builds use the same dir
|
||||||
npm test # vitest (worker/, src/lib); worker/test/* D1 tests spawn a local workerd via getPlatformProxy
|
npm test # vitest (worker/, src/lib); worker/test/* D1 tests spawn a local workerd via getPlatformProxy
|
||||||
|
npm run test:coverage # the same with v8 coverage → coverage/lcov.info (repo-root paths, for SonarQube Cloud)
|
||||||
npm run lint && npm run knip && npx tsc -b
|
npm run lint && npm run knip && npx tsc -b
|
||||||
npm run cf:types # after editing wrangler.jsonc (ignores .dev.vars via types.env; CI runs it with --check)
|
npm run cf:types # after editing wrangler.jsonc (ignores .dev.vars via types.env; CI runs it with --check)
|
||||||
npm run cf:check # wrangler deploy --dry-run with the project's wrangler (what CI runs; after a build)
|
npm run cf:check # wrangler deploy --dry-run with the project's wrangler (what CI runs; after a build)
|
||||||
@@ -79,7 +80,8 @@ Each game has **20** fields (plus optional `added_at` / `updated_at`, appended b
|
|||||||
| `refresh.yml` | Daily 02:47 UTC + `workflow_dispatch` (`budget`, `url`, `allow_mass_removal`, `full`) | scan (read-only, 55-min step timeout, checks out the branch as it is when the job starts — not the queued SHA — so runs waiting in the queue see the previous run's state; patch artifact uploaded `if: always()`) → apply (`!cancelled()`: a failed / timed-out scan's checkpoint is applied, a cancelled run's is not) → notify. Workflow-level `concurrency: refresh-pipeline` + `queue: max` runs one whole scan → apply at a time (scheduled, manual and force-update runs alike). Removal needs the same 404/410, paid or `private` (itch.io's password form, `is_password_protected`; ingest drops such links as final) strike seen again ≥ 20 h after the first sighting (`strike_at`). Checkpoints never carry removals. **Mass-change guard:** a run whose removals or new strikes exceed max(10, 10 %) of the games it checked withholds all its removals and marks them — and, on a strike spike, all its strikes — `withheld_at`; later runs keep withholding those (they take at most half a run's budget) until a healthy check clears them, and alert (`mass_change`) — that pattern means itch.io markup changed; dispatch with `allow_mass_removal` only after checking on itch.io. `apply_patch.py` re-checks the same per-run limit and max(25, 5 %) of the catalog unless `ALLOW_MASS_REMOVAL=1`. |
|
| `refresh.yml` | Daily 02:47 UTC + `workflow_dispatch` (`budget`, `url`, `allow_mass_removal`, `full`) | scan (read-only, 55-min step timeout, checks out the branch as it is when the job starts — not the queued SHA — so runs waiting in the queue see the previous run's state; patch artifact uploaded `if: always()`) → apply (`!cancelled()`: a failed / timed-out scan's checkpoint is applied, a cancelled run's is not) → notify. Workflow-level `concurrency: refresh-pipeline` + `queue: max` runs one whole scan → apply at a time (scheduled, manual and force-update runs alike). Removal needs the same 404/410, paid or `private` (itch.io's password form, `is_password_protected`; ingest drops such links as final) strike seen again ≥ 20 h after the first sighting (`strike_at`). Checkpoints never carry removals. **Mass-change guard:** a run whose removals or new strikes exceed max(10, 10 %) of the games it checked withholds all its removals and marks them — and, on a strike spike, all its strikes — `withheld_at`; later runs keep withholding those (they take at most half a run's budget) until a healthy check clears them, and alert (`mass_change`) — that pattern means itch.io markup changed; dispatch with `allow_mass_removal` only after checking on itch.io. `apply_patch.py` re-checks the same per-run limit and max(25, 5 %) of the catalog unless `ALLOW_MASS_REMOVAL=1`. |
|
||||||
| `force_update.yml` | `workflow_dispatch` ONLY (`url`, `budget`, `allow_mass_removal`) | Dispatches `refresh.yml` with `full: true` (`actions: write`; it used to call it through `uses:`, which failed at startup with no annotation): re-scrapes every scraper field for one URL or the next batch (rotates on `full` timestamps). Dispatch it N times in a row to cover N consecutive batches (FIFO, each from the latest main). Always preserves `safe_virus` / `notes` / `nsfw`. Canonical tool for repairing mojibake. |
|
| `force_update.yml` | `workflow_dispatch` ONLY (`url`, `budget`, `allow_mass_removal`) | Dispatches `refresh.yml` with `full: true` (`actions: write`; it used to call it through `uses:`, which failed at startup with no annotation): re-scrapes every scraper field for one URL or the next batch (rotates on `full` timestamps). Dispatch it N times in a row to cover N consecutive batches (FIFO, each from the latest main). Always preserves `safe_virus` / `notes` / `nsfw`. Canonical tool for repairing mojibake. |
|
||||||
| `notify-failure.yml` | `workflow_call` | Discord (`DISCORD_CI_WEBHOOK`) on failure / **cancelled** (job-level timeouts end as cancelled) / rate-limited / mass change / failed Cloudflare build. |
|
| `notify-failure.yml` | `workflow_call` | Discord (`DISCORD_CI_WEBHOOK`) on failure / **cancelled** (job-level timeouts end as cancelled) / rate-limited / mass change / failed Cloudflare build. |
|
||||||
| `python-ci.yml` / `webapp-ci.yml` | PRs (+ pushes for Python) | ruff + format + vulture + pytest + `validate.py` (both requirements locks installed at once, so drifting pins fail) / `npm ci --ignore-scripts` + `npm run check:tauri` (gotcha 31) + `npm run cf:types -- --check` + lint + knip + vitest + build + `npm run cf:check` (`wrangler deploy --dry-run`). A SonarQube Cloud check also runs on PRs (gotcha 41). |
|
| `python-ci.yml` / `webapp-ci.yml` | PRs (+ pushes for Python) | ruff + format + vulture + pytest + `validate.py` (both requirements locks installed at once, so drifting pins fail) / `npm ci --ignore-scripts` + `npm run check:tauri` (gotcha 31) + `npm run cf:types -- --check` + lint + knip + vitest + build + `npm run cf:check` (`wrangler deploy --dry-run`). SonarQube Cloud runs in `sonarcloud.yml`. |
|
||||||
|
| `sonarcloud.yml` | Push to `main` + PRs (both skip data-only and `.md`-only changes) + `workflow_dispatch` | SonarQube Cloud CI analysis (gotcha 41): `token` (no `SONAR_TOKEN` — Dependabot and fork PRs — → notice, the rest skipped) → `coverage` (pytest-cov + Vitest v8, no secrets; artifact kept 1 day) → `scan` (`sonarqube-scan-action`, full history, `sonar.projectVersion` from `webapp/package.json`; the only step that uses the token). |
|
||||||
| `deploy-status.yml` | Hourly + manual | Not a deploy. `bash/cf_build_status.sh` walks main's first-parent history to the latest finished `Workers Builds: free-games-itchio-list` check run (Cloudflare posts it only when a build ends; branch commits carry preview builds under the same name) and alerts once per failed build (cache key per check-run id, saved after the Discord post). Scheduled because GitHub never starts `check_run` workflows for `GITHUB_TOKEN` pushes (the data commits). |
|
| `deploy-status.yml` | Hourly + manual | Not a deploy. `bash/cf_build_status.sh` walks main's first-parent history to the latest finished `Workers Builds: free-games-itchio-list` check run (Cloudflare posts it only when a build ends; branch commits carry preview builds under the same name) and alerts once per failed build (cache key per check-run id, saved after the Discord post). Scheduled because GitHub never starts `check_run` workflows for `GITHUB_TOKEN` pushes (the data commits). |
|
||||||
| `release_desktop.yml` | Tag `v*` push, or manual | `create-release` makes the single draft (id passed to tauri-action v1 `releaseId`); release builds use **no** npm/cargo caches (cache-poisoning). Win + macOS aarch64 + macOS x86_64 (cross-compile) + Linux (`ubuntu-22.04` for a low glibc floor). Uploads `.dmg` / `.app.tar.gz` / `.pkg` (macOS), `.msi` / `.exe` (Windows), `.deb` / `.rpm` / `.AppImage` (Linux). macOS `.pkg` `--identifier` reads `tauri.conf.json`. |
|
| `release_desktop.yml` | Tag `v*` push, or manual | `create-release` makes the single draft (id passed to tauri-action v1 `releaseId`); release builds use **no** npm/cargo caches (cache-poisoning). Win + macOS aarch64 + macOS x86_64 (cross-compile) + Linux (`ubuntu-22.04` for a low glibc floor). Uploads `.dmg` / `.app.tar.gz` / `.pkg` (macOS), `.msi` / `.exe` (Windows), `.deb` / `.rpm` / `.AppImage` (Linux). macOS `.pkg` `--identifier` reads `tauri.conf.json`. |
|
||||||
| `release_android.yml` | Tag `v*` push, or manual | Tauri **Android** build → arm64-v8a APK, **post-signed** with `zipalign`+`apksigner` (gen/ stays gitignored). Tag → attaches to the same draft Release; manual dispatch → workflow artifact. Secrets: `ANDROID_KEYSTORE_BASE64` / `ANDROID_KEYSTORE_PASSWORD` / `ANDROID_KEY_ALIAS`. |
|
| `release_android.yml` | Tag `v*` push, or manual | Tauri **Android** build → arm64-v8a APK, **post-signed** with `zipalign`+`apksigner` (gen/ stays gitignored). Tag → attaches to the same draft Release; manual dispatch → workflow artifact. Secrets: `ANDROID_KEYSTORE_BASE64` / `ANDROID_KEYSTORE_PASSWORD` / `ANDROID_KEY_ALIAS`. |
|
||||||
@@ -147,7 +149,7 @@ Code **MIT** (`LICENSE`); catalog data **CC BY 4.0** for the maintainer's contri
|
|||||||
38. **npm 11.20+ (Node 26) gates dependency install scripts on `allowScripts` in `webapp/package.json`.** esbuild and workerd are approved by name (their postinstall only checks the platform binary). A new dependency with an install script shows up in `npm install-scripts ls`; review it, then `npm install-scripts approve <pkg> --no-allow-scripts-pin` (name-only, so Dependabot bumps stay covered).
|
38. **npm 11.20+ (Node 26) gates dependency install scripts on `allowScripts` in `webapp/package.json`.** esbuild and workerd are approved by name (their postinstall only checks the platform binary). A new dependency with an install script shows up in `npm install-scripts ls`; review it, then `npm install-scripts approve <pkg> --no-allow-scripts-pin` (name-only, so Dependabot bumps stay covered).
|
||||||
39. **Dependabot's pip updater reads `.python-version` and aborts on a Python it doesn't support** (3.10–3.14 as of Oct 2026): a `3.15` there stopped pip version updates and the pip dependency graph ("Dependabot detected the following Python requirement … '3.15.*'"). So the CI pin lives in `.github/python-version`, which only `setup-python`'s `python-version-file` reads (python-ci, refresh ×2, update); move it back to `.python-version` once Dependabot lists 3.15.
|
39. **Dependabot's pip updater reads `.python-version` and aborts on a Python it doesn't support** (3.10–3.14 as of Oct 2026): a `3.15` there stopped pip version updates and the pip dependency graph ("Dependabot detected the following Python requirement … '3.15.*'"). So the CI pin lives in `.github/python-version`, which only `setup-python`'s `python-version-file` reads (python-ci, refresh ×2, update); move it back to `.python-version` once Dependabot lists 3.15.
|
||||||
40. **The Python requirements are hash-locked pip-tools compiles** — `requirements.txt` ← `requirements.in`, `requirements-dev.txt` ← `requirements-dev.in` (`-c requirements.txt`) — installed everywhere with `--require-hashes --only-binary :all:`, so a new release of any dependency, indirect ones included, can't reach the jobs that push to `main`, and no sdist build script runs. After editing a `.in`, recompile with **pip-tools on Python 3.14**: `pip-compile --generate-hashes --allow-unsafe --strip-extras requirements.in`, then the same for `requirements-dev.in`. Dependabot takes the Python version from the `# … autogenerated by pip-compile with Python X.Y` header and supports ≤ 3.14 (gotcha 39); the hashes cover every file of a release, so CI's 3.15 still finds its cp315 wheels. `colorama` is listed in `requirements-dev.in` because pytest needs it on Windows only: a lock compiled on Linux (Dependabot's) would otherwise leave it out and the hash-checked local install would fail. Keep those pip commands in a block scalar (`run: |`): in a plain YAML scalar the `: ` of `:all: -r` makes the whole workflow file invalid — GitHub then records a 0-job failed push run named after the file, and a PR simply shows no check for that workflow.
|
40. **The Python requirements are hash-locked pip-tools compiles** — `requirements.txt` ← `requirements.in`, `requirements-dev.txt` ← `requirements-dev.in` (`-c requirements.txt`) — installed everywhere with `--require-hashes --only-binary :all:`, so a new release of any dependency, indirect ones included, can't reach the jobs that push to `main`, and no sdist build script runs. After editing a `.in`, recompile with **pip-tools on Python 3.14**: `pip-compile --generate-hashes --allow-unsafe --strip-extras requirements.in`, then the same for `requirements-dev.in`. Dependabot takes the Python version from the `# … autogenerated by pip-compile with Python X.Y` header and supports ≤ 3.14 (gotcha 39); the hashes cover every file of a release, so CI's 3.15 still finds its cp315 wheels. `colorama` is listed in `requirements-dev.in` because pytest needs it on Windows only: a lock compiled on Linux (Dependabot's) would otherwise leave it out and the hash-checked local install would fail. Keep those pip commands in a block scalar (`run: |`): in a plain YAML scalar the `: ` of `:all: -r` makes the whole workflow file invalid — GitHub then records a 0-job failed push run named after the file, and a PR simply shows no check for that workflow.
|
||||||
41. **SonarQube Cloud runs Automatic Analysis** (project `poli0981_free-games-itchio-list`, public; PRs get a "SonarCloud Code Analysis" check). It reads only `.sonarcloud.properties` (sources / tests / exclusions — no per-rule ignores; mark a false positive on the issue itself). Two of its suggested fixes are wrong here: S2871 wants `localeCompare` in `.sort()`, but chunk names, migration files and `unblocked.json` keep code-unit order (= Python's `sorted()`) — pass `compareCodeUnits` (`worker/text.ts`); S8906 wants `select_one('div.a.b')` for bs4's `class_=[a, b]`, which means *either* class — write a selector list `div.a, div.b`. Trim trailing characters with `trimEnd()` (`worker/text.ts`), not `/x+$/` (S8786: quadratic backtracking on a long run). Known false positive: css:S8776 on Tailwind v4's `@utility … { &::-webkit-scrollbar … }` (the `&` is required for variants).
|
41. **SonarQube Cloud analyses in CI** (`sonarcloud.yml` + `sonar-project.properties`; project `poli0981_free-games-itchio-list`, public). Automatic Analysis is switched off on sonarcloud.io — switched back on, it makes the CI scan fail. PRs get a "SonarCloud Code Analysis" check from the SonarQube Cloud app; Dependabot and fork PRs get no `SONAR_TOKEN`, so their analysis is skipped with a notice (a Dependabot secret of that name would enable it). Tests run in the `coverage` job without the token; besides the `token` job's presence check, only the `scan` step gets it, in a job that runs no project code. Binary images and the D1 migrations (SQLite, claimed by the Oracle PL/SQL analyzer, which then warned on every run) are excluded from the analysis. Coverage: `pytest --cov` (`[tool.coverage.run]` in `pyproject.toml`) and `npm run test:coverage` (`test.coverage` in `vite.config.ts`; the lcov reporter's `projectRoot` is the repo root, so the scanner resolves the paths); `@vitest/coverage-v8` needs vitest's exact version (Dependabot group `vitest`). The built-in "Sonar way" gate fails a PR under 80 % coverage on new code (from 20 new lines up), so code without unit tests by design is in `sonar.coverage.exclusions` — keep that list in step with what the tests reach. `sonar.projectVersion` comes from `webapp/package.json`: on `main`, "new code" (previous version) starts over at each version bump. `sonar.python.version` stays 3.14 until SonarQube Cloud's analyzer supports 3.15 (it warns "No explicit support for version 3.15"). The free plan keeps only `main` and PRs: a manual run on another branch uploads a branch analysis nobody can open ("not allowed to access data from non main branches"). Mark a false positive on the issue itself. Two of its suggested fixes are wrong here: S2871 wants `localeCompare` in `.sort()`, but chunk names, migration files and `unblocked.json` keep code-unit order (= Python's `sorted()`) — pass `compareCodeUnits` (`worker/text.ts`); S8906 wants `select_one('div.a.b')` for bs4's `class_=[a, b]`, which means *either* class — write a selector list `div.a, div.b`. Trim trailing characters with `trimEnd()` (`worker/text.ts`), not `/x+$/` (S8786: quadratic backtracking on a long run). Known false positive: css:S8776 on Tailwind v4's `@utility … { &::-webkit-scrollbar … }` (the `&` is required for variants).
|
||||||
|
|
||||||
## Safe-edit rules
|
## Safe-edit rules
|
||||||
|
|
||||||
@@ -158,6 +160,8 @@ Code **MIT** (`LICENSE`); catalog data **CC BY 4.0** for the maintainer's contri
|
|||||||
|
|
||||||
## Current state (Oct 2026)
|
## Current state (Oct 2026)
|
||||||
|
|
||||||
|
**SonarQube Cloud CI** (2026-10-22, not in a release's notes yet): CI-based analysis with test coverage replaced Automatic Analysis — `sonarcloud.yml`, `sonar-project.properties` (tests marked as tests, coverage exclusions, `.sonarcloud.properties` removed), `pytest-cov` + `@vitest/coverage-v8` (gotcha 41).
|
||||||
|
|
||||||
**Toolchain** (2026-10-22, #149 + #154, shipped in 4.4.2): TypeScript 7.0.2 (`@typescript/native`; `typescript` = the 6.0 API alias, gotcha 6), Node 26 (`webapp/.node-version`, `engines >=26`, `@types/node` 26, Workers Builds `NODE_VERSION` raised to 26 by the owner in the dashboard — `docs/operations.md` §1 step 1), Python 3.15 (`.github/python-version` — gotcha 39, ruff `py315`, `urllib3` declared since `scraper.py` imports it). No source change was needed: TS 7 reports 0 errors, the suites pass on Node 26.12 and Python 3.15.1.
|
**Toolchain** (2026-10-22, #149 + #154, shipped in 4.4.2): TypeScript 7.0.2 (`@typescript/native`; `typescript` = the 6.0 API alias, gotcha 6), Node 26 (`webapp/.node-version`, `engines >=26`, `@types/node` 26, Workers Builds `NODE_VERSION` raised to 26 by the owner in the dashboard — `docs/operations.md` §1 step 1), Python 3.15 (`.github/python-version` — gotcha 39, ruff `py315`, `urllib3` declared since `scraper.py` imports it). No source change was needed: TS 7 reports 0 errors, the suites pass on Node 26.12 and Python 3.15.1.
|
||||||
|
|
||||||
**v4.4.2** (2026-10-22): SonarQube Cloud cleanup — the scan's 57 issues: 45 fixed in code, the 11 on the saved itch.io test pages excluded by `.sonarcloud.properties`, css:S8776 (Tailwind `@utility`) left for the owner to mark a false positive (gotcha 41). Worker paths and the gate cookie's padding are trimmed by `trimEnd()` (a `/\/+$/` on the public 404 path was quadratic), the feed / collection parsers have no backtracking regexes left, `compareCodeUnits` makes the code-unit sorts explicit, the NSFW notices are one selector list (each tested). Supply chain: hash-locked Python deps + wheels only in every workflow (gotcha 40), `npm ci --ignore-scripts` in CI and the release builds, `npm run cf:check` instead of `npx wrangler`. `scripts/i18n-edit.mjs` reads its operations from stdin (`node scripts/i18n-edit.mjs < ops.json`). Ships the toolchain upgrade and Dependabot #141–#148, #150, #152, #153.
|
**v4.4.2** (2026-10-22): SonarQube Cloud cleanup — the scan's 57 issues: 45 fixed in code, the 11 on the saved itch.io test pages excluded by `.sonarcloud.properties`, css:S8776 (Tailwind `@utility`) left for the owner to mark a false positive (gotcha 41). Worker paths and the gate cookie's padding are trimmed by `trimEnd()` (a `/\/+$/` on the public 404 path was quadratic), the feed / collection parsers have no backtracking regexes left, `compareCodeUnits` makes the code-unit sorts explicit, the NSFW notices are one selector list (each tested). Supply chain: hash-locked Python deps + wheels only in every workflow (gotcha 40), `npm ci --ignore-scripts` in CI and the release builds, `npm run cf:check` instead of `npx wrangler`. `scripts/i18n-edit.mjs` reads its operations from stdin (`node scripts/i18n-edit.mjs < ops.json`). Ships the toolchain upgrade and Dependabot #141–#148, #150, #152, #153.
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ Details live in the [Terms of Use](docs/ToS.md) and the [Disclaimer](docs/DISCLA
|
|||||||
|
|
||||||
**PR rules** (the non-negotiable part):
|
**PR rules** (the non-negotiable part):
|
||||||
|
|
||||||
- **CI must pass.** Python CI (ruff check + format, vulture, pytest, `validate.py`) and Webapp CI (type generation check, lint, knip, tests, build, `wrangler deploy --dry-run`) both run on PRs. Red CI = no merge.
|
- **CI must pass.** Python CI (ruff check + format, vulture, pytest, `validate.py`) and Webapp CI (type generation check, lint, knip, tests, build, `wrangler deploy --dry-run`) both run on PRs. Red CI = no merge. SonarQube Cloud also analyses each PR (with test coverage) and reports its quality gate as the "SonarCloud Code Analysis" check.
|
||||||
- **PRs are merged with squash** (one PR becomes one commit on `main`) **or a merge commit, never by fast-forward**, so make the PR title a good commit message (the repo uses the `type(scope): summary` style, e.g. `fix(web): …`).
|
- **PRs are merged with squash** (one PR becomes one commit on `main`) **or a merge commit, never by fast-forward**, so make the PR title a good commit message (the repo uses the `type(scope): summary` style, e.g. `fix(web): …`).
|
||||||
- **Licensing is inbound = outbound.** By opening a PR you agree that your contribution is licensed under the same license as the part it changes: **MIT** for code, **CC BY 4.0** for catalog data and documentation (see [README → License](README.md#license)). Only submit work you have the right to submit.
|
- **Licensing is inbound = outbound.** By opening a PR you agree that your contribution is licensed under the same license as the part it changes: **MIT** for code, **CC BY 4.0** for catalog data and documentation (see [README → License](README.md#license)). Only submit work you have the right to submit.
|
||||||
- **Never commit secrets**: no tokens, API keys, `.dev.vars` / `.env` files, private keys (such as the GitHub App key) or signing keystores. If you pushed one by accident, report it privately (security@poli0981.dev) and rotate it; deleting the commit is not enough.
|
- **Never commit secrets**: no tokens, API keys, `.dev.vars` / `.env` files, private keys (such as the GitHub App key) or signing keystores. If you pushed one by accident, report it privately (security@poli0981.dev) and rotate it; deleting the commit is not enough.
|
||||||
|
|||||||
+5
-1
@@ -115,10 +115,12 @@ These tools never end up in a build, but they keep the code honest.
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
| [Vite](https://vite.dev) 8 and `@vitejs/plugin-react` | Bundling the site, the admin app and the apps' front end | MIT |
|
| [Vite](https://vite.dev) 8 and `@vitejs/plugin-react` | Bundling the site, the admin app and the apps' front end | MIT |
|
||||||
| [Vitest](https://vitest.dev) 5 | Tests (`npm test`) | MIT |
|
| [Vitest](https://vitest.dev) 5 | Tests (`npm test`) | MIT |
|
||||||
|
| [`@vitest/coverage-v8`](https://vitest.dev/guide/coverage) 5 | Test coverage for SonarQube Cloud (`npm run test:coverage`) | MIT |
|
||||||
| [Wrangler](https://developers.cloudflare.com/workers/wrangler/) 4 | Local Worker dev, D1 migrations, deploys | MIT OR Apache-2.0 |
|
| [Wrangler](https://developers.cloudflare.com/workers/wrangler/) 4 | Local Worker dev, D1 migrations, deploys | MIT OR Apache-2.0 |
|
||||||
| [`@tauri-apps/cli`](https://tauri.app) 2 | Building the desktop and Android apps | Apache-2.0 OR MIT |
|
| [`@tauri-apps/cli`](https://tauri.app) 2 | Building the desktop and Android apps | Apache-2.0 OR MIT |
|
||||||
| `@types/node`, `@types/react`, `@types/react-dom` | Type definitions | MIT |
|
| `@types/node`, `@types/react`, `@types/react-dom` | Type definitions | MIT |
|
||||||
| [pytest](https://pytest.org) | Python tests (network blocked) | MIT |
|
| [pytest](https://pytest.org) | Python tests (network blocked) | MIT |
|
||||||
|
| [pytest-cov](https://pytest-cov.readthedocs.io) and [coverage.py](https://coverage.readthedocs.io) | Python test coverage for SonarQube Cloud (`pytest --cov`) | MIT; Apache-2.0 |
|
||||||
| [Pillow](https://python-pillow.github.io) | [`webapp/scripts/gen_assets.py`](../webapp/scripts/gen_assets.py), which generates the icons and the social preview image | MIT-CMU |
|
| [Pillow](https://python-pillow.github.io) | [`webapp/scripts/gen_assets.py`](../webapp/scripts/gen_assets.py), which generates the icons and the social preview image | MIT-CMU |
|
||||||
|
|
||||||
## 6. GitHub Actions
|
## 6. GitHub Actions
|
||||||
@@ -126,7 +128,8 @@ These tools never end up in a build, but they keep the code honest.
|
|||||||
The workflows in [`.github/workflows/`](../.github/workflows/) use `actions/checkout`, `actions/setup-node`,
|
The workflows in [`.github/workflows/`](../.github/workflows/) use `actions/checkout`, `actions/setup-node`,
|
||||||
`actions/setup-python`, `actions/setup-java`, `actions/cache`, `actions/upload-artifact`,
|
`actions/setup-python`, `actions/setup-java`, `actions/cache`, `actions/upload-artifact`,
|
||||||
`actions/download-artifact`, `android-actions/setup-android`, `dtolnay/rust-toolchain`,
|
`actions/download-artifact`, `android-actions/setup-android`, `dtolnay/rust-toolchain`,
|
||||||
`tauri-apps/tauri-action` and reusable workflows from [poli0981/.github](https://github.com/poli0981/.github).
|
`tauri-apps/tauri-action`, `SonarSource/sonarqube-scan-action` and reusable workflows from
|
||||||
|
[poli0981/.github](https://github.com/poli0981/.github).
|
||||||
Every external action is pinned to a commit SHA. The actions run on GitHub's runners and are not
|
Every external action is pinned to a commit SHA. The actions run on GitHub's runners and are not
|
||||||
distributed with the project; each one is under the license in its own repository.
|
distributed with the project; each one is under the license in its own repository.
|
||||||
|
|
||||||
@@ -137,6 +140,7 @@ distributed with the project; each one is under the license in its own repositor
|
|||||||
| **Cloudflare** | DNS, CDN, WAF, TLS; Workers and static assets (the website); R2 (resized cover images); D1 (the review queue); Images (resizing); Turnstile (the verification page and the Suggest page); Web Analytics (cookieless, aggregate); Workers Logs; Access (admin login); Rate Limiting |
|
| **Cloudflare** | DNS, CDN, WAF, TLS; Workers and static assets (the website); R2 (resized cover images); D1 (the review queue); Images (resizing); Turnstile (the verification page and the Suggest page); Web Analytics (cookieless, aggregate); Workers Logs; Access (admin login); Rate Limiting |
|
||||||
| **Google Workspace** | The Maintainer's mailbox on poli0981.dev, which receives the project's contact addresses |
|
| **Google Workspace** | The Maintainer's mailbox on poli0981.dev, which receives the project's contact addresses |
|
||||||
| **GitHub** | Code, catalog data, issues and discussions, Actions (the pipeline), release downloads |
|
| **GitHub** | Code, catalog data, issues and discussions, Actions (the pipeline), release downloads |
|
||||||
|
| **SonarQube Cloud** (SonarSource) | Code analysis and test coverage of the public repository, on pushes to `main` and on pull requests |
|
||||||
| **itch.io** | Where the games live; the pipeline and RSS discovery read public itch.io pages and feeds |
|
| **itch.io** | Where the games live; the pipeline and RSS discovery read public itch.io pages and feeds |
|
||||||
| **Discord** | Receives automated CI and release notifications only |
|
| **Discord** | Receives automated CI and release notifications only |
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ vulture # dead code
|
|||||||
python scripts/validate.py # checks every catalog data file
|
python scripts/validate.py # checks every catalog data file
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`pytest --cov --cov-report=xml` also measures coverage and writes `coverage.xml`, as the SonarQube
|
||||||
|
Cloud workflow (`sonarcloud.yml`) does.
|
||||||
|
|
||||||
### Try a real scrape
|
### Try a real scrape
|
||||||
|
|
||||||
These make real requests to itch.io:
|
These make real requests to itch.io:
|
||||||
@@ -179,6 +182,9 @@ npm run build
|
|||||||
npm run cf:check # wrangler deploy --dry-run: validates the Worker config, deploys nothing
|
npm run cf:check # wrangler deploy --dry-run: validates the Worker config, deploys nothing
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`npm run test:coverage` runs the tests with v8 coverage and writes `coverage/lcov.info`, as the
|
||||||
|
SonarQube Cloud workflow (`sonarcloud.yml`) does.
|
||||||
|
|
||||||
After editing `wrangler.jsonc`, run `npm run cf:types` and commit the regenerated
|
After editing `wrangler.jsonc`, run `npm run cf:types` and commit the regenerated
|
||||||
`worker-configuration.d.ts`.
|
`worker-configuration.d.ts`.
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ Chi tiết có trong [Điều khoản sử dụng](ToS.md) và [Tuyên bố mi
|
|||||||
|
|
||||||
**Quy tắc PR** (phần không thương lượng):
|
**Quy tắc PR** (phần không thương lượng):
|
||||||
|
|
||||||
- **CI phải pass.** Python CI (ruff check + format, vulture, pytest, `validate.py`) và Webapp CI (kiểm tra type sinh ra, lint, knip, test, build, `wrangler deploy --dry-run`) đều chạy trên PR. CI đỏ = không merge.
|
- **CI phải pass.** Python CI (ruff check + format, vulture, pytest, `validate.py`) và Webapp CI (kiểm tra type sinh ra, lint, knip, test, build, `wrangler deploy --dry-run`) đều chạy trên PR. CI đỏ = không merge. SonarQube Cloud cũng phân tích mỗi PR (kèm test coverage) và báo quality gate qua check "SonarCloud Code Analysis".
|
||||||
- **PR được merge bằng squash** (một PR thành một commit trên `main`) **hoặc merge commit, không bao giờ fast-forward**, nên hãy đặt tiêu đề PR như một commit message tốt (repo dùng kiểu `type(scope): tóm tắt`, ví dụ `fix(web): …`).
|
- **PR được merge bằng squash** (một PR thành một commit trên `main`) **hoặc merge commit, không bao giờ fast-forward**, nên hãy đặt tiêu đề PR như một commit message tốt (repo dùng kiểu `type(scope): tóm tắt`, ví dụ `fix(web): …`).
|
||||||
- **Giấy phép theo nguyên tắc inbound = outbound.** Khi mở PR, bạn đồng ý rằng đóng góp của mình được cấp phép theo cùng giấy phép với phần mà nó thay đổi: **MIT** cho mã nguồn, **CC BY 4.0** cho dữ liệu danh mục và tài liệu (xem [README → Giấy phép](../../../README.vi.md#giấy-phép)). Chỉ gửi những gì bạn có quyền gửi.
|
- **Giấy phép theo nguyên tắc inbound = outbound.** Khi mở PR, bạn đồng ý rằng đóng góp của mình được cấp phép theo cùng giấy phép với phần mà nó thay đổi: **MIT** cho mã nguồn, **CC BY 4.0** cho dữ liệu danh mục và tài liệu (xem [README → Giấy phép](../../../README.vi.md#giấy-phép)). Chỉ gửi những gì bạn có quyền gửi.
|
||||||
- **Không bao giờ commit secret**: không token, API key, file `.dev.vars` / `.env`, private key (chẳng hạn khóa của GitHub App) hay keystore dùng để ký. Nếu lỡ push một cái, hãy báo riêng (security@poli0981.dev) và thay mới (rotate) nó; chỉ xóa commit là không đủ.
|
- **Không bao giờ commit secret**: không token, API key, file `.dev.vars` / `.env`, private key (chẳng hạn khóa của GitHub App) hay keystore dùng để ký. Nếu lỡ push một cái, hãy báo riêng (security@poli0981.dev) và thay mới (rotate) nó; chỉ xóa commit là không đủ.
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ vulture # code chết
|
|||||||
python scripts/validate.py # kiểm tra mọi file dữ liệu catalog
|
python scripts/validate.py # kiểm tra mọi file dữ liệu catalog
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`pytest --cov --cov-report=xml` đo thêm coverage và ghi `coverage.xml`, giống workflow SonarQube Cloud
|
||||||
|
(`sonarcloud.yml`).
|
||||||
|
|
||||||
### Thử scrape thật
|
### Thử scrape thật
|
||||||
|
|
||||||
Các lệnh này gửi request thật tới itch.io:
|
Các lệnh này gửi request thật tới itch.io:
|
||||||
@@ -180,6 +183,9 @@ npm run build
|
|||||||
npm run cf:check # wrangler deploy --dry-run: kiểm tra cấu hình Worker, không deploy gì
|
npm run cf:check # wrangler deploy --dry-run: kiểm tra cấu hình Worker, không deploy gì
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`npm run test:coverage` chạy test kèm coverage v8 và ghi `coverage/lcov.info`, giống workflow
|
||||||
|
SonarQube Cloud (`sonarcloud.yml`).
|
||||||
|
|
||||||
Sau khi sửa `wrangler.jsonc`, chạy `npm run cf:types` và commit file `worker-configuration.d.ts` vừa
|
Sau khi sửa `wrangler.jsonc`, chạy `npm run cf:types` và commit file `worker-configuration.d.ts` vừa
|
||||||
được tạo lại.
|
được tạo lại.
|
||||||
|
|
||||||
|
|||||||
@@ -22,3 +22,11 @@ ignore_names = ["no_network"]
|
|||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
# tests/conftest.py blocks all network access; parser tests use saved fixtures.
|
# tests/conftest.py blocks all network access; parser tests use saved fixtures.
|
||||||
addopts = "-q"
|
addopts = "-q"
|
||||||
|
|
||||||
|
# `pytest --cov --cov-report=xml` writes coverage.xml for SonarQube Cloud
|
||||||
|
# (.github/workflows/sonarcloud.yml); plain `pytest` measures nothing.
|
||||||
|
# Relative paths, so the scan job resolves them in its own checkout.
|
||||||
|
[tool.coverage.run]
|
||||||
|
source = ["scripts"]
|
||||||
|
relative_files = true
|
||||||
|
branch = true
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
-r requirements.in
|
-r requirements.in
|
||||||
ruff>=0.17.1
|
ruff>=0.17.1
|
||||||
pytest>=9.1.1
|
pytest>=9.1.1
|
||||||
|
# `pytest --cov`: coverage.xml for SonarQube Cloud (.github/workflows/sonarcloud.yml).
|
||||||
|
pytest-cov>=7.1.0
|
||||||
vulture>=2.16
|
vulture>=2.16
|
||||||
pillow>=13.0.0
|
pillow>=13.0.0
|
||||||
# pytest needs it on Windows only; listed so a lock compiled on Linux (Dependabot) still installs there.
|
# pytest needs it on Windows only; listed so a lock compiled on Linux (Dependabot) still installs there.
|
||||||
|
|||||||
+132
-1
@@ -198,6 +198,129 @@ colorama==0.4.6 \
|
|||||||
# via
|
# via
|
||||||
# -r requirements-dev.in
|
# -r requirements-dev.in
|
||||||
# pytest
|
# pytest
|
||||||
|
coverage==7.16.2 \
|
||||||
|
--hash=sha256:00d3eb96e9988c45f50cccd1f1496571ac5c1f91386ac02c4d55516eeda19a24 \
|
||||||
|
--hash=sha256:01c6908bc613b420c26c818fe948e1b97dfd041a53c98b01c63bd8321f5c9aae \
|
||||||
|
--hash=sha256:066429634299e14dd2d511e1e85f8f9cecc500781f6b41907c0dd6f1baea7e63 \
|
||||||
|
--hash=sha256:0993d0e90858c03943d3cb152e068a20dd4707924deec84dd2230261baae3b1b \
|
||||||
|
--hash=sha256:0dcbcfcc059117284c603ff8cb61a65872512882f84a8cf0339241f7f7c2f148 \
|
||||||
|
--hash=sha256:0fd7a86fdda7cb6d616d178654bd0ad6bc0f3f33c2e478aa598500a1a9e34eda \
|
||||||
|
--hash=sha256:11d28e9123a9156cb405d8d27b44256c9a58fb5decc2073a8f17862057e3aa0f \
|
||||||
|
--hash=sha256:11e597173af1dc33d5f8a7332ada544199269a223af1ee1770ddd5e245ad0fe8 \
|
||||||
|
--hash=sha256:126d1af8804d7224421fe991ff65d3ce649081560df7a98b1a5ffff07f9923bd \
|
||||||
|
--hash=sha256:14253fc7bb15749b849795a06f5d3b6d8bc3fb8a4b5ddc341faf7a89dce205fc \
|
||||||
|
--hash=sha256:152877cdc8a07264882cfcd503ba56a3ef6cba56a70e8c70f6eb8ffd7384789a \
|
||||||
|
--hash=sha256:17228fbca0f22976f797be94e975dcd237799c657d49551c7de1e0654d1202e9 \
|
||||||
|
--hash=sha256:191803c4996b499fcd78c2ad5e5f767dcc53cb4dc6de6d6a741b443a1821ef02 \
|
||||||
|
--hash=sha256:1a37c6e478cf687e1aa30a593d19c92c02fad9d122b51ab73f51b8dc7a0c0fc9 \
|
||||||
|
--hash=sha256:1c569a9fd25505f1cd6bea90588818f90373ce90e2632e2cacf19ddbd6e14fdb \
|
||||||
|
--hash=sha256:1d56e4d21c56d2046447733f8b118409597db48c01efe898ee9ac24e858ec2d6 \
|
||||||
|
--hash=sha256:1d5d0e3b660506fb84f995814e3118a21efdc0c8eb80127da1be627d90093c17 \
|
||||||
|
--hash=sha256:1f15254427c9b33eedac4f198eaf9e356eb4f6214551afb43da6194a2c088ad7 \
|
||||||
|
--hash=sha256:218d742afca2b5ad5ca759e93eddedfbcc6eadf8322f080dcefc40b7bd4e2d48 \
|
||||||
|
--hash=sha256:22957cef43ce038641de78ba995de7568d2d6a37c6ddbf7fa0fd7d1ae2344d91 \
|
||||||
|
--hash=sha256:23219888477edd736b6fcaec1272d47d93b926e999641ffea7e53a1738e70b2b \
|
||||||
|
--hash=sha256:251aed777c47c77aba047096d4542889db089227655711dfc2b9c54ef0e15e35 \
|
||||||
|
--hash=sha256:28ff850182a67d117990fa2ce5ea1032836d8c9630dae867e8bdd3bff4533b79 \
|
||||||
|
--hash=sha256:29309ccc86b7f33df7db12813c299f215bbbc470ed6292d0bedd63ffae1ebf64 \
|
||||||
|
--hash=sha256:2aca0bdfa9e91621d5b09d815357bf63def4fc0e9cb66da67bf2cf93f3b1a6f5 \
|
||||||
|
--hash=sha256:30c1b65d529e46569899fadca59e4a87c1faf2886923f1307ba61e654d4f3c20 \
|
||||||
|
--hash=sha256:35f37886699cb9abd29958247d718628d5bc6f39e623dff66a09e546c42a7e03 \
|
||||||
|
--hash=sha256:382d3346d56b0eec1b793d53a4c88799c8053f516aa3a8d7c44315696954bacf \
|
||||||
|
--hash=sha256:396bb16e04ce04efbb3df91456ae4e3da918e69ecdf67fb711b0a0fdf35ccce0 \
|
||||||
|
--hash=sha256:3e7f99698ba3a7d13988bdd984b7ebf13af4dbe2166dc8502eef90d77603b0a4 \
|
||||||
|
--hash=sha256:3e861f1071dcc2fec1e88bef0920f6b1eaa66a143555b4f8ab79ba2b0f30ef55 \
|
||||||
|
--hash=sha256:3f43bac1856ba269b905302778d4df433d6006489a192174ad77ac528e395032 \
|
||||||
|
--hash=sha256:40c0f00899fe6181ae7f434ceb200e51f5ee4b8ed10e3b5f0b605f0cae15da87 \
|
||||||
|
--hash=sha256:414c26dfdb96aac2d570a54e03008f001e32eb2d413705365503648c6bd361d8 \
|
||||||
|
--hash=sha256:4358b9c8c0125b460407f3017c6cce8156e904b32772c5630d27112f52bdbfe5 \
|
||||||
|
--hash=sha256:444889f7f66b74e4455c0a97e0e166dd41177f1dca8c0239a47cff25e05ba7e1 \
|
||||||
|
--hash=sha256:44f21e407b278efdfc1ee5e481e00518bd1d500310a30a5fbf2bcbedfef4aaf0 \
|
||||||
|
--hash=sha256:4cc4f73aa3fabc36e32046d6cd2971405948d8a903636508a3d3b2f9128b3a95 \
|
||||||
|
--hash=sha256:4dbbd1155ca46e6e0b6b89d204428c56ef6a459af21333f365d135a2820e5a09 \
|
||||||
|
--hash=sha256:4ee546b9e4872ffa194bf07ac87bfa1202ebb824d0795dc1ef22f175545ca90a \
|
||||||
|
--hash=sha256:5139009b5efd2194fc168ee9362f0e191ba612ef5d29242f9269c22f9b8f80c7 \
|
||||||
|
--hash=sha256:5375ebd99038021b35e99dc88255022912c06565d316212f4a576e4b08d30f5d \
|
||||||
|
--hash=sha256:5397e21a90dde0e9c6896b77ded8f0be26b66f8b22b33aed41f6043ed95d55e6 \
|
||||||
|
--hash=sha256:57ff3783f99d75a1e81dd56a9737eb5665e6736a5d93258ba596b6dcad8fd05b \
|
||||||
|
--hash=sha256:58d4a54c6ea672afef66d49be922a2c69826c5ae1a42a9cd94f0c9c2bacdf800 \
|
||||||
|
--hash=sha256:59c3926585e1cd1f2190f4b2ac9014de1bbeaf0d5d0587b0dc6b0aa90d17896a \
|
||||||
|
--hash=sha256:5a27b731c171e43dc8b5f32b76a5051dde2ec9b9366c87028f08a7088ebc2c7b \
|
||||||
|
--hash=sha256:5b3146d2317c75f70df2509066d979dadd941f7021cdf9b5db4bcd8568258e25 \
|
||||||
|
--hash=sha256:5dca0bb66b4c3d624ba047887bf70270030c150692d543cb501293dc38a9f4b5 \
|
||||||
|
--hash=sha256:611a44e5229a59d7483ce830160e1a0e85f700562c7a5651c7c63fb8f4eb528c \
|
||||||
|
--hash=sha256:648352b94507179d82637292e7ae8802508d95f78e2f00a705a50b6c48011681 \
|
||||||
|
--hash=sha256:6a75180829efb8ae62b4aded25be6ddca1c888d138d2d82e21d93bfbd88f41cb \
|
||||||
|
--hash=sha256:705e5af11d34647efdc170c7840b6857c81cf74be96419a553f237e68e62cb72 \
|
||||||
|
--hash=sha256:723dcdab91357159b722935b500ee8abc0a66c8c432e1e9fabf4cc7598952de8 \
|
||||||
|
--hash=sha256:724bd0f1e81856b35e59fc98cf7b4e544a3cb662e4e0864dca73d4326ee9d808 \
|
||||||
|
--hash=sha256:732d950e51f3ba4fb6209c73250f3e8924fefca42953ee04a9e65d8c02414d7d \
|
||||||
|
--hash=sha256:736fde09ea39646d11f8e3b76bd3425c075aa4dd45f24891970bb77c14ff20f5 \
|
||||||
|
--hash=sha256:7a076277ca9f5750cc230f0f578ebd2620cec60255b25707361699fef6fb465c \
|
||||||
|
--hash=sha256:7b3bce4a0d05401d70b7d0d5ca783e686bc9d30e81dbd7d980d532609bf809e4 \
|
||||||
|
--hash=sha256:7b451c68218c150f616bc9649783ec8de76a59792c759b43aa0c9c0466a465e4 \
|
||||||
|
--hash=sha256:7d0732c83746bc24123c581a85d9dd96b70ddb538c9076020aa1a041790361e9 \
|
||||||
|
--hash=sha256:7ed238d227e23cc300c3d464babdaf9f6ddc740aa1b15a77ae96136e6a7c4516 \
|
||||||
|
--hash=sha256:80d3f7b48d43ee8fc5e8707a8adb43d743a5a1a85256c25a24f9d6d0e2238fa6 \
|
||||||
|
--hash=sha256:80e9fdb4c3d926b6ba721d4bf7435bdb869c3527ae7803290361d0ab73db13b6 \
|
||||||
|
--hash=sha256:848893e1d361448c113dc2f0913503522a6f7be231d0e38333d2a22d9698a011 \
|
||||||
|
--hash=sha256:893ea9cf86cb8d2546812ac93d973aaf2ee1fb45110a873b014214fd23e3725e \
|
||||||
|
--hash=sha256:8afd9bf35cc6a1f22eb3634808fa8e0b91902459c5721ef2e4461dfe771d7f08 \
|
||||||
|
--hash=sha256:8be099e979fc42559328a21828281b4578304191ae46ed4e80a407048a82eee6 \
|
||||||
|
--hash=sha256:8e209591f7c41ae4a9171335cf6156afda0b21de73b02f73f5aa95b2d5fbb08d \
|
||||||
|
--hash=sha256:8fc15cc8d0d06e873c00ef18e1372d605f9aaf3de27d8c24e50782e75bc8b843 \
|
||||||
|
--hash=sha256:9174f0af24e5eff248b9dbfe76ec5275a3d19d37edbc2810543f12cf97347a34 \
|
||||||
|
--hash=sha256:921415102a90637fcc2e3f169f61dad7699ecf690e8639fc21b813acbedc0967 \
|
||||||
|
--hash=sha256:967d72c835d7a8cf0af99ec813a2d06e3db6df706402f1fe85b31b437645f495 \
|
||||||
|
--hash=sha256:98d9c97f51b334b0adce7b964442a9af33c1a00c6ac856984cc5dc8d18f81c75 \
|
||||||
|
--hash=sha256:99704f73721e23859112072d522076e11c31744fc96b5652e5dd2018aa4359f7 \
|
||||||
|
--hash=sha256:9a75a4704ff640e46170042eec1f984385a121227c505d5a16ad8e495f452541 \
|
||||||
|
--hash=sha256:9acc7f7ec4a1b5f89bd929fde5b8a714f6fafdc6cc18725413d510aa082b47ad \
|
||||||
|
--hash=sha256:9c6afdd69218202bc1758c9a14b86b8cf1084f37ed2ca143e567a103772b16d1 \
|
||||||
|
--hash=sha256:9cdf19874e0d247f32f03609200370343c3c7aa260b191d8c2bb251d36198283 \
|
||||||
|
--hash=sha256:9e1d0ced76318bab499693ff25f64faa343415187cb2e4d7befdfdd391a1cf6a \
|
||||||
|
--hash=sha256:9fd670ac43b709c575aefc25bf52d8a598a3bc5017bddfd0a179152ab06a2deb \
|
||||||
|
--hash=sha256:a0f2285329dac10ab08f79cb11f5692c497018e6c7c511f95e6fd63a70b8f831 \
|
||||||
|
--hash=sha256:a2fac6895eb299a2e52d7bbb8fb3903502b9da8d3f5309ceb16ec40c646b58ee \
|
||||||
|
--hash=sha256:a336eec40e3520d369b8a6cdabb4f596e69a8b42927ca074aa1452fed943238a \
|
||||||
|
--hash=sha256:a4624f80732f6b427ac58f1f59c577a0994a12e8174b5af6a027b4b58795d4c3 \
|
||||||
|
--hash=sha256:a56ac4fa5a75c7e182e8f62600cfb4aff43c5ed7356a034f3557659c3bec1d90 \
|
||||||
|
--hash=sha256:a678c0b6b22086ec2427359d22e37445d4a792f5fdbbc744112c7dade65cad02 \
|
||||||
|
--hash=sha256:a740ea6f083c6db7b926534d159508f80ba275ab35e722522de0d18d0f56e55f \
|
||||||
|
--hash=sha256:a90700f743e29aa3d75a6ff5f01953176a889c00e526194bc4d281731b88d99d \
|
||||||
|
--hash=sha256:a9a638be322a8d76a41cdb17781c7f82aaee6a66493d8ffb7e2c09ee22423d99 \
|
||||||
|
--hash=sha256:a9cd3de0a5bfe7b0e21ee10e1a14e3d61bf52efc88217ab1d95d6ace6970bd46 \
|
||||||
|
--hash=sha256:aa62c85046473959c13ba9edca9dc90a77d5c1095b1ba313556314d77fe5b036 \
|
||||||
|
--hash=sha256:aba5c63b7afdc749cc9eae943d5b868cba2b261a176378fa1c5a30bc8bc89982 \
|
||||||
|
--hash=sha256:ac0f3b379c94acc2f7dce5f5f0b24d44fa1cc6a509717ef83dfee07450c2117c \
|
||||||
|
--hash=sha256:af2a2a8c7c74de0559e0c368d94c8def9e16c58faaee33a0bf081057c4227e3b \
|
||||||
|
--hash=sha256:af98ad5ed9d6daaca956201e00bb429a7eb2b080426686f70a20353e0f9839f5 \
|
||||||
|
--hash=sha256:afdf43b72ef3876c1fe66423b91466e37877c9e81e8cec70542b7e8525b9d1b7 \
|
||||||
|
--hash=sha256:b88841e654f09732804809e435b3e005a929ffd9998b872b7b213957b8759cb8 \
|
||||||
|
--hash=sha256:bb2fc905bbf4e6b7f40806ea79e31515abf6349594cdf0adf27c4215f0463204 \
|
||||||
|
--hash=sha256:bb4ffe96aa663cee727659db5a2afeb38c95f8677b747d447b90d6d4874ea2c5 \
|
||||||
|
--hash=sha256:bc0b0ac781d489304b741269857f1f8338b7a26b1b89c06c0344658001ec0035 \
|
||||||
|
--hash=sha256:bf1bd822ec4e387ed245bed0d71151582cf7be9e5309bc4145eefe36083d5878 \
|
||||||
|
--hash=sha256:c19cd6d025c1673f22afcd22c7df8a662d779e05d8e3fa6820c22afb895b0206 \
|
||||||
|
--hash=sha256:c3305c38a2fa21a4254f2ace7dd9ef5fc569c9a558b66e7017650b3d637fb95e \
|
||||||
|
--hash=sha256:c85d54e7e8a2ca932fe8399301af9b8d5907ea2a455ffaff6e7d1208db83b943 \
|
||||||
|
--hash=sha256:ca64d9f1f384f151b9511bec01126072acd2f313439f8ed015a22d8790aab6fa \
|
||||||
|
--hash=sha256:cce2bc991293f15cc4084ca116827b5900c5f34e1a54dfe83f10ab5c43162eb7 \
|
||||||
|
--hash=sha256:d6276d78f6fca7d0ac066d5da4165c5acd07829e8305c2cb900b738fb3a75a72 \
|
||||||
|
--hash=sha256:d93db87adb6b1c1b408dce4763314b55d76a9f589e96783a84ac9e7689e48bdf \
|
||||||
|
--hash=sha256:db5f8394e17f877a625b257f2ba0ce8e728a499c2c1579ad66220272cd3df510 \
|
||||||
|
--hash=sha256:db76506aa5416081f3e8974ae0f7965c58ada0bb0ef7339ac86099588dbb20d3 \
|
||||||
|
--hash=sha256:dba2edfb054f6d4a08df9d1637c39a5aa3865bca6617c13c86be21e45658a59c \
|
||||||
|
--hash=sha256:dcf4bc2aab4e16b1c4c0c2005918f23a7dd5d7821ddae82caed9e3342dc2fcce \
|
||||||
|
--hash=sha256:e1fa594c887365b69745f25a416806e61085dd07b94c9eae68a6e20730629b23 \
|
||||||
|
--hash=sha256:e6c52d3307824ff93b39efd99e4185d557db40bd841452abfb32e5d9151ca162 \
|
||||||
|
--hash=sha256:eb57acff4a74246ae513c142d4b36e18c389c3aed8661914a53f7cd0071031b2 \
|
||||||
|
--hash=sha256:f80bd9f9633eafc73d0a913ba2645c96ba58bba1befc30590f7c0fbfde59d865 \
|
||||||
|
--hash=sha256:f8475460aa33ee28ac896ab1156d0bb3b6c639f7f8383c2677d3359eb35f8205 \
|
||||||
|
--hash=sha256:fb2bde05838fffae1a1bf75e5d411a6cac3e4e9bb97e6640fed8cd47888b33f0 \
|
||||||
|
--hash=sha256:fb9d92ecfe2d5b494367c67f7446f8b75b68d8d0c8cf3bc3e6997478be25d9e2 \
|
||||||
|
--hash=sha256:fd3d72233eb8b48acc94fa57d44e2d32ce8e7abed02882ccb6d855ccc4ed33ec
|
||||||
|
# via pytest-cov
|
||||||
idna==3.20 \
|
idna==3.20 \
|
||||||
--hash=sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44 \
|
--hash=sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44 \
|
||||||
--hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c
|
--hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c
|
||||||
@@ -300,7 +423,9 @@ pillow==13.0.0 \
|
|||||||
pluggy==1.7.0 \
|
pluggy==1.7.0 \
|
||||||
--hash=sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec \
|
--hash=sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec \
|
||||||
--hash=sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8
|
--hash=sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8
|
||||||
# via pytest
|
# via
|
||||||
|
# pytest
|
||||||
|
# pytest-cov
|
||||||
pygments==2.21.0 \
|
pygments==2.21.0 \
|
||||||
--hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \
|
--hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \
|
||||||
--hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c
|
--hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c
|
||||||
@@ -308,6 +433,12 @@ pygments==2.21.0 \
|
|||||||
pytest==9.1.1 \
|
pytest==9.1.1 \
|
||||||
--hash=sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313 \
|
--hash=sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313 \
|
||||||
--hash=sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c
|
--hash=sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c
|
||||||
|
# via
|
||||||
|
# -r requirements-dev.in
|
||||||
|
# pytest-cov
|
||||||
|
pytest-cov==7.1.0 \
|
||||||
|
--hash=sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2 \
|
||||||
|
--hash=sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678
|
||||||
# via -r requirements-dev.in
|
# via -r requirements-dev.in
|
||||||
requests==2.34.2 \
|
requests==2.34.2 \
|
||||||
--hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \
|
--hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# SonarQube Cloud, CI-based analysis: .github/workflows/sonarcloud.yml
|
||||||
|
# (https://sonarcloud.io/project/overview?id=poli0981_free-games-itchio-list).
|
||||||
|
# Automatic Analysis is switched off on sonarcloud.io: the two can't run together.
|
||||||
|
# Mark a false positive on the issue itself (CLAUDE.md, gotcha 41).
|
||||||
|
sonar.organization=poli0981
|
||||||
|
sonar.projectKey=poli0981_free-games-itchio-list
|
||||||
|
sonar.projectName=free-games-itchio-list
|
||||||
|
sonar.sourceEncoding=UTF-8
|
||||||
|
# The project runs on 3.15 (.github/python-version), but SonarQube Cloud's Python
|
||||||
|
# analyzer stops at 3.14 ("No explicit support for version 3.15", then it falls
|
||||||
|
# back to 3.14). Raise this once it supports 3.15.
|
||||||
|
sonar.python.version=3.14
|
||||||
|
|
||||||
|
# The whole repository, as Automatic Analysis read it, with the tests as tests.
|
||||||
|
sonar.sources=.
|
||||||
|
# The tests (below); the binary images, which, indexed as text, only made the
|
||||||
|
# scanner warn about their encoding; and the D1 migrations, SQLite that the
|
||||||
|
# Oracle PL/SQL analyzer claims, only to warn that it has no data dictionary.
|
||||||
|
sonar.exclusions=tests/**,webapp/**/*.test.*,webapp/worker/test/**,**/*.png,**/*.ico,**/*.icns,**/*.webp,**/*.sql
|
||||||
|
sonar.tests=.
|
||||||
|
sonar.test.inclusions=tests/**,webapp/**/*.test.*,webapp/worker/test/**
|
||||||
|
# itch.io pages saved as served, for the scraper tests: their markup is
|
||||||
|
# itch.io's (tables without <th>, tabindex on divs, …), and editing it would
|
||||||
|
# make the tests check something itch.io never sends.
|
||||||
|
sonar.test.exclusions=tests/fixtures/**
|
||||||
|
|
||||||
|
# Written by the workflow's coverage job, with paths from the repository root:
|
||||||
|
# `pytest --cov --cov-report=xml` (Cobertura) and `npm run test:coverage` (lcov).
|
||||||
|
sonar.python.coverage.reportPaths=coverage.xml
|
||||||
|
sonar.javascript.lcov.reportPaths=webapp/coverage/lcov.info
|
||||||
|
# No unit tests by design — the React UI (components, routes, hooks, stores),
|
||||||
|
# the i18n message catalogs, configs, maintainer tools and the Tauri shell — so
|
||||||
|
# they don't count towards coverage (the "Sonar way" quality gate wants 80 % on
|
||||||
|
# new code). Keep this list in step with what the tests can reach.
|
||||||
|
sonar.coverage.exclusions=\
|
||||||
|
**/*.tsx,\
|
||||||
|
webapp/src/components/**,\
|
||||||
|
webapp/src/hooks/**,\
|
||||||
|
webapp/src/lib/use-*.ts,\
|
||||||
|
webapp/src/stores/**,\
|
||||||
|
webapp/src/lib/i18n/**,\
|
||||||
|
webapp/*.config.*,\
|
||||||
|
webapp/scripts/gen_assets.py,\
|
||||||
|
webapp/scripts/i18n-edit.mjs,\
|
||||||
|
webapp/src-tauri/**
|
||||||
Generated
+104
@@ -46,6 +46,7 @@
|
|||||||
"@types/react-dom": "^19.3.0",
|
"@types/react-dom": "^19.3.0",
|
||||||
"@typescript/native": "npm:typescript@^7.0.2",
|
"@typescript/native": "npm:typescript@^7.0.2",
|
||||||
"@vitejs/plugin-react": "^6.1.2",
|
"@vitejs/plugin-react": "^6.1.2",
|
||||||
|
"@vitest/coverage-v8": "^5.0.5",
|
||||||
"eslint": "^10.12.0",
|
"eslint": "^10.12.0",
|
||||||
"eslint-plugin-react-hooks": "^7.1.1",
|
"eslint-plugin-react-hooks": "^7.1.1",
|
||||||
"eslint-plugin-react-refresh": "^0.5.7",
|
"eslint-plugin-react-refresh": "^0.5.7",
|
||||||
@@ -303,6 +304,16 @@
|
|||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@bcoe/v8-coverage": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@cacheable/memory": {
|
"node_modules/@cacheable/memory": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz",
|
||||||
@@ -5550,6 +5561,58 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@vitest/coverage-v8": {
|
||||||
|
"version": "5.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.0.5.tgz",
|
||||||
|
"integrity": "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@bcoe/v8-coverage": "^1.0.2",
|
||||||
|
"@vitest/istanbul-lib-coverage": "^1.0.2",
|
||||||
|
"@vitest/istanbul-lib-report": "^1.0.2",
|
||||||
|
"ast-v8-to-istanbul": "^1.0.7",
|
||||||
|
"magicast": "^0.5.5",
|
||||||
|
"obug": "^3.0.0",
|
||||||
|
"std-env": "^4.3.0",
|
||||||
|
"tinyrainbow": "^3.2.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/vitest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@vitest/browser": "5.0.5",
|
||||||
|
"vitest": "5.0.5"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@vitest/browser": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@vitest/istanbul-lib-coverage": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@vitest/istanbul-lib-report": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@vitest/istanbul-lib-coverage": "1.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@vitest/mocker": {
|
"node_modules/@vitest/mocker": {
|
||||||
"version": "5.0.5",
|
"version": "5.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
|
||||||
@@ -5650,6 +5713,25 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ast-v8-to-istanbul": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-kFL68AG6ajd8fg248zwM9GQrUWEp79gsmjum34OEXjs4yHuUMZfYKwOLW9GMmB4oNvVrj+EAGxsP7ye2UR9UlA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/trace-mapping": "^0.3.31",
|
||||||
|
"estree-walker": "^3.0.3",
|
||||||
|
"js-tokens": "^10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ast-v8-to-istanbul/node_modules/js-tokens": {
|
||||||
|
"version": "10.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz",
|
||||||
|
"integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "4.0.4",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
|
||||||
@@ -7127,6 +7209,18 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.6.0"
|
"@jridgewell/sourcemap-codec": "^1.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/magicast": {
|
||||||
|
"version": "0.5.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.5.tgz",
|
||||||
|
"integrity": "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/parser": "^7.29.7",
|
||||||
|
"@babel/types": "^7.29.7",
|
||||||
|
"source-map-js": "^1.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/miniflare": {
|
"node_modules/miniflare": {
|
||||||
"version": "5.20261006.1-alpha",
|
"version": "5.20261006.1-alpha",
|
||||||
"resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261006.1-alpha.tgz",
|
"resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261006.1-alpha.tgz",
|
||||||
@@ -8036,6 +8130,16 @@
|
|||||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tinyrainbow": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ts-api-utils": {
|
"node_modules/ts-api-utils": {
|
||||||
"version": "2.5.0",
|
"version": "2.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
"tauri:dev": "tauri dev",
|
"tauri:dev": "tauri dev",
|
||||||
"tauri:build": "tauri build",
|
"tauri:build": "tauri build",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
|
"test:coverage": "vitest run --coverage",
|
||||||
"check:tauri": "node scripts/check-tauri-versions.mjs",
|
"check:tauri": "node scripts/check-tauri-versions.mjs",
|
||||||
"cf:types": "wrangler types --env-file=types.env --strict-vars=false",
|
"cf:types": "wrangler types --env-file=types.env --strict-vars=false",
|
||||||
"cf:check": "wrangler deploy --dry-run --env=",
|
"cf:check": "wrangler deploy --dry-run --env=",
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
"@types/react-dom": "^19.3.0",
|
"@types/react-dom": "^19.3.0",
|
||||||
"@typescript/native": "npm:typescript@^7.0.2",
|
"@typescript/native": "npm:typescript@^7.0.2",
|
||||||
"@vitejs/plugin-react": "^6.1.2",
|
"@vitejs/plugin-react": "^6.1.2",
|
||||||
|
"@vitest/coverage-v8": "^5.0.5",
|
||||||
"eslint": "^10.12.0",
|
"eslint": "^10.12.0",
|
||||||
"eslint-plugin-react-hooks": "^7.1.1",
|
"eslint-plugin-react-hooks": "^7.1.1",
|
||||||
"eslint-plugin-react-refresh": "^0.5.7",
|
"eslint-plugin-react-refresh": "^0.5.7",
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ export const THIRD_PARTY: ThirdParty[] = [
|
|||||||
{ name: 'jose', version: '6.2', license: 'MIT', url: 'https://github.com/panva/jose', category: 'dev' },
|
{ name: 'jose', version: '6.2', license: 'MIT', url: 'https://github.com/panva/jose', category: 'dev' },
|
||||||
{ name: 'Wrangler', version: '4.147', license: 'MIT OR Apache-2.0', url: 'https://developers.cloudflare.com/workers/wrangler/', category: 'dev' },
|
{ name: 'Wrangler', version: '4.147', license: 'MIT OR Apache-2.0', url: 'https://developers.cloudflare.com/workers/wrangler/', category: 'dev' },
|
||||||
{ name: 'Vitest', version: '5.0', license: 'MIT', url: 'https://vitest.dev', category: 'dev' },
|
{ name: 'Vitest', version: '5.0', license: 'MIT', url: 'https://vitest.dev', category: 'dev' },
|
||||||
|
{ name: '@vitest/coverage-v8', version: '5.0', license: 'MIT', url: 'https://vitest.dev/guide/coverage', category: 'dev' },
|
||||||
|
|
||||||
// Desktop / mobile (Tauri)
|
// Desktop / mobile (Tauri)
|
||||||
{ name: 'Tauri', version: '2.x', license: 'Apache-2.0 OR MIT', url: 'https://tauri.app', category: 'desktop' },
|
{ name: 'Tauri', version: '2.x', license: 'Apache-2.0 OR MIT', url: 'https://tauri.app', category: 'desktop' },
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/// <reference types="vitest/config" />
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
@@ -76,5 +77,18 @@ export default defineConfig({
|
|||||||
'/img': 'http://localhost:8787',
|
'/img': 'http://localhost:8787',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
test: {
|
||||||
|
// `npm run test:coverage` writes coverage/lcov.info for SonarQube Cloud
|
||||||
|
// (.github/workflows/sonarcloud.yml); plain `npm test` measures nothing.
|
||||||
|
// Paths from the repository root, where the scanner resolves them.
|
||||||
|
coverage: {
|
||||||
|
provider: 'v8',
|
||||||
|
// Source files, including those no test loads (at 0 %) — not index.html,
|
||||||
|
// the D1 migrations, the test helpers or type declarations.
|
||||||
|
include: ['**/*.{ts,tsx,mjs}'],
|
||||||
|
exclude: ['**/*.d.ts', 'worker/test/**', 'src-tauri/**'],
|
||||||
|
reporter: [['lcovonly', { projectRoot: repoRoot }], 'text-summary'],
|
||||||
|
},
|
||||||
|
},
|
||||||
clearScreen: false,
|
clearScreen: false,
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user