CI phase 1: one pipeline, deploy gated on lint, test and audit #46

Merged
jared merged 2 commits from ci-phase1 into main 2026-11-22 02:20:38 -05:00
Owner

Phase 1 of #45.

Why

Until now, the deploy job lived in lint.yml and needed only eslint, while jest and npm audit ran as separate workflows. A merge that failed its tests still deployed to production. Gandalf's pipeline has the same gap, because every LotusGuild repo was built from the same template.

What changes

  • One pipeline: .gitea/workflows/ci.yml runs lint, test, audit, deploy and notify. deploy needs all three checks and runs only on push to main. lint.yml, test.yml and security.yml are removed. The weekly Monday audit cron is kept.

  • Reproducible builds: npm ci everywhere. eslint comes from the lockfile (new npm run lint), where CI used to run npm install --save-dev eslint@8. setup-node is pinned to Node 20, which matches production and the worker.

  • Supply chain: actions/checkout and actions/setup-node are pinned to full commit SHAs with the version in a comment, following tinker_tickets.

  • Permissions: the workflow defaults to contents: read, and only deploy gets write access, for its tag.

  • Concurrency: deploys queue in a deploy-production group instead of overlapping, and superseded branch runs are cancelled.

  • Deploy:

    • The payload now carries sha and a timestamp, so each deploy's signature is unique. The server will verify them in phase 2; until then it still deploys origin/main.
    • After the webhook, CI waits until Pulse serves again before tagging. This is a liveness check only; /healthz with the SHA comes in phase 2.
  • Alerts: Matrix now gets an alert for any failed job on main, for a failed weekly audit, and for every successful deploy. Before, only lint failures alerted.

  • House style: lint fails on em or en dashes (and —, – and escaped forms) in Pulse-owned files.

  • npm audit fix: the new audit gate caught live advisories in production dependencies. This is a lockfile-only change with no major bumps:

    • proxy-addr 2.0.8 (critical)
    • body-parser 2.4.0 (high)
    • follow-redirects 1.16.3 (high; the worker uses it through axios)
    • qs and ip-address

    The remaining glob/minimatch advisories are moderate, dev-only (jest) and need a breaking upgrade.

Verified

  • Branch run 3759: lint, test and audit pass; deploy and notify are skipped off main. The pinned v4 actions work on our runner.
  • Locally: jest passes (61). Both end-to-end harnesses still pass after the dependency bumps: reliability 13/13, and WebSocket auth 15/15 (enforcement off) and 12/12 (on).

After merge: update branch protection (Settings > Branches > main)

Replace the old required check with:

  • CI / Lint (eslint) (push)
  • CI / Test (jest) (push)
  • CI / Security (npm audit) (push)

(Add the (pull_request) variants as well if you want them required on PRs.)

🤖 Generated with Claude Code

Phase 1 of #45. ## Why Until now, the deploy job lived in `lint.yml` and needed only eslint, while jest and npm audit ran as separate workflows. **A merge that failed its tests still deployed to production.** Gandalf's pipeline has the same gap, because every LotusGuild repo was built from the same template. ## What changes - **One pipeline:** `.gitea/workflows/ci.yml` runs `lint`, `test`, `audit`, `deploy` and `notify`. `deploy` needs all three checks and runs only on push to `main`. `lint.yml`, `test.yml` and `security.yml` are removed. The weekly Monday audit cron is kept. - **Reproducible builds:** `npm ci` everywhere. eslint comes from the lockfile (new `npm run lint`), where CI used to run `npm install --save-dev eslint@8`. `setup-node` is pinned to Node 20, which matches production and the worker. - **Supply chain:** `actions/checkout` and `actions/setup-node` are pinned to full commit SHAs with the version in a comment, following tinker_tickets. - **Permissions:** the workflow defaults to `contents: read`, and only `deploy` gets write access, for its tag. - **Concurrency:** deploys queue in a `deploy-production` group instead of overlapping, and superseded branch runs are cancelled. - **Deploy:** - The payload now carries `sha` and a timestamp, so each deploy's signature is unique. The server will verify them in phase 2; until then it still deploys `origin/main`. - After the webhook, CI waits until Pulse serves again before tagging. This is a liveness check only; `/healthz` with the SHA comes in phase 2. - **Alerts:** Matrix now gets an alert for any failed job on `main`, for a failed weekly audit, and for every successful deploy. Before, only lint failures alerted. - **House style:** lint fails on em or en dashes (and `—`, `–` and escaped forms) in Pulse-owned files. - **`npm audit fix`:** the new audit gate caught live advisories in production dependencies. This is a lockfile-only change with no major bumps: - `proxy-addr` 2.0.8 (critical) - `body-parser` 2.4.0 (high) - `follow-redirects` 1.16.3 (high; the worker uses it through axios) - `qs` and `ip-address` The remaining `glob`/`minimatch` advisories are moderate, dev-only (jest) and need a breaking upgrade. ## Verified - Branch run [3759](https://code.lotusguild.org/LotusGuild/pulse/actions/runs/3759): lint, test and audit pass; deploy and notify are skipped off `main`. The pinned v4 actions work on our runner. - Locally: jest passes (61). Both end-to-end harnesses still pass after the dependency bumps: reliability 13/13, and WebSocket auth 15/15 (enforcement off) and 12/12 (on). ## After merge: update branch protection (Settings > Branches > main) Replace the old required check with: - `CI / Lint (eslint) (push)` - `CI / Test (jest) (push)` - `CI / Security (npm audit) (push)` (Add the `(pull_request)` variants as well if you want them required on PRs.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 2 commits 2026-11-22 02:14:51 -05:00
CI: one pipeline, deploy gated on lint, test and audit
CI / Lint (eslint) (push) Failing after 56s
CI / Test (jest) (push) Successful in 1m0s
CI / Security (npm audit) (push) Failing after 10s
CI / Deploy (push) Skipped
CI / Notify (push) Skipped
fde2c49eca
The deploy job lived in lint.yml and needed only eslint, while jest and
npm audit ran in separate workflows. A merge that failed its tests still
deployed to production. (#45 phase 1)

- Combine everything into .gitea/workflows/ci.yml with jobs lint, test,
  audit, deploy and notify. Deploy needs all three checks and runs only
  on push to main.
- Builds are reproducible: npm ci everywhere, eslint from the lockfile
  (new `npm run lint`), and setup-node pinned to Node 20 (production).
- Actions are pinned to full commit SHAs, with the version in a comment,
  following tinker_tickets.
- Workflow permissions default to contents: read; only deploy can write
  (for its tag). A deploy-production concurrency group queues deploys
  instead of running two at once. Superseded branch runs are cancelled.
- The deploy payload now carries the sha and a timestamp, so signatures
  differ per deploy (the server verifies them in phase 2). After the
  webhook, CI waits until Pulse is serving again before tagging.
- The Matrix alert now fires for any failed job on main, for the weekly
  audit, and for every successful deploy.
- New lint step: fail on em or en dashes in Pulse-owned files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI: fix dash check matching itself; npm audit fix for production advisories
CI / Test (jest) (push) Successful in 20s
CI / Lint (eslint) (push) Successful in 21s
CI / Security (npm audit) (push) Successful in 10s
CI / Deploy (push) Skipped
CI / Notify (push) Skipped
CI / Lint (eslint) (pull_request) Successful in 21s
CI / Test (jest) (pull_request) Successful in 21s
CI / Security (npm audit) (pull_request) Successful in 7s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
6da2d15397
- The dash check's own pattern contained the literal entities it searches
  for. Use &[mn]dash; so the check doesn't flag itself.
- npm audit fix (lockfile only, no major bumps): proxy-addr 2.0.8
  (critical), body-parser 2.4.0 (high), follow-redirects 1.16.3 (high,
  used by the worker through axios), qs 6.17.1, ip-address. The remaining
  glob/minimatch advisories are moderate, dev-only (jest) and need a
  breaking upgrade, so they stay below the high threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared scheduled this pull request to auto merge when all checks succeed 2026-11-22 02:14:58 -05:00
jared merged commit b10ea154dd into main 2026-11-22 02:20:38 -05:00
jared deleted branch ci-phase1 2026-11-22 02:20:40 -05:00
Sign in to join this conversation.