codeburn/.github/workflows/tests.yml
Resham Joshi 8262a3ea7d
chore: raise the Node floor to 22.15 and make zstd unconditional (#1846)
* chore: raise the Node floor to 22.15 and make zstd unconditional

Node's built-in zstd in node:zlib arrived in 22.15. With the floor at 22.13
every reader of Codex's compressed .jsonl.zst rollouts had to check for it,
and the daily cache kept a separate generation for Nodes without it so a later
Node upgrade would still re-derive their days. That split could not survive
another cache bump.

The engines field, the launcher's version check, .nvmrc, the README and the
CI pins now say 22.15. The VS Code extension applies the same floor when it
picks a Node to run the CLI, and its runtime notice names it.

Removed: the optional zstd exports, zstdSupported and requireZstd in
fs-utils, the skipped-compressed-rollouts notice in launcher-homes, and the
76/77 split in the daily cache, which is now 77 for every Node.

* docs: say 22.15 wherever the Node floor is stated
2026-11-04 17:37:28 +01:00

156 lines
5.9 KiB
YAML

name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# Package floor (zstd is built in from 22.15), the newest 22.x, and the
# current LTS plus current release so warnings newer Node prints reach
# the suite.
node-version: [22.15.0, 22, 24, 26]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Typecheck
run: npx tsc --noEmit
# The cache-refresh-lock files exercise a cross-process file lock and are
# parallelism-sensitive (they fail under full worker pressure and pass serially -
# reproduced repeatedly on unmodified main), so they run in their own serial step
# below instead of making every PR roll dice.
# Scoping (tests/ only, app/ excluded) lives in the package.json test
# script since #948, so CI and a contributor's `npm test` can never drift.
- name: Test suite (parallel)
run: npm test -- --reporter=default --reporter=json --outputFile.json=test-report.json
- name: Slowest tests
if: always()
run: node scripts/slowest-tests.mjs test-report.json
# Single forked worker, so lock contention comes only from the child
# processes the tests spawn deliberately. Serial because the suite is
# parallelism-sensitive (fails under full worker pressure, passes
# serially). After #904 the loser of a stale-lock contest may be
# timed-out or completed-by-other; this step gates CI.
# This step takes 12-18s on every Node version (64-job sample, no upward
# trend). Every failure so far has been a hang that printed nothing at
# all - not one line of vitest output after its RUN banner - which the
# 5-minute step limit then killed silently. Cap each attempt at 90s (5x
# the worst passing run) so the log shows a bounded failure, and retry
# once: a hang a change actually introduced reproduces on the second
# attempt and still fails the job, while the startup hang that has never
# once produced a wrong result costs 90s instead of a whole re-run. The
# warning keeps every occurrence visible rather than silently green.
- name: Cache-lock suite (serial)
timeout-minutes: 4
run: |
timeout 90 npm run test:locks && exit 0
echo "::warning::cache-lock suite did not finish in 90s (normal 12-18s) - retrying once"
timeout 90 npm run test:locks
# The CLI is shipped to macOS and Windows users, and the Windows tray app depends on it
# there. One run per platform on the newest Node 22, without the serial lock suite, which
# is Linux-tuned. The Windows run uses three workers: the suite spawns the CLI through tsx
# often, and a Windows runner falls over under the default worker count.
test-platforms:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: npm
- run: npm ci
- name: Typecheck
run: npx tsc --noEmit
- name: Test suite
run: npm test -- --maxWorkers=3 --reporter=default --reporter=json --outputFile.json=test-report.json
- name: Slowest tests
if: always()
run: node scripts/slowest-tests.mjs test-report.json
desktop:
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: app
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.15.0
cache: npm
cache-dependency-path: app/package-lock.json
- run: npm ci
- name: Typecheck
run: npm run typecheck
- name: Test suite
run: npm test
- name: Build
run: npm run build
# The VS Code extension (publisher.name codeburn.codeburn): its host code, the
# renderer's webview build, the bundled CLI, a packaged .vsix, and a smoke run
# in a real VS Code under xvfb against a fixture home.
vscode:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.15.0
cache: npm
cache-dependency-path: |
package-lock.json
app/package-lock.json
vscode/package-lock.json
- run: npm ci
- name: Install the renderer
run: npm ci
working-directory: app
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
- name: Install the extension
run: npm ci
working-directory: vscode
- name: Typecheck
run: npm run typecheck
working-directory: vscode
- name: Unit tests
run: npm test
working-directory: vscode
- name: Webview bridge tests
run: npx vitest run renderer/vscode renderer/i18n
working-directory: app
- name: Build and package
run: npm run package
working-directory: vscode
- name: Smoke test in VS Code
run: xvfb-run -a npm run test:smoke
working-directory: vscode
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: codeburn-vscode
path: vscode/*.vsix
if-no-files-found: error