Skip to content

Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.

Split Windows tests across four runners and skip CI for site and docs changes (#201)

Eduardo Machado7e85fca2a221
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 59f6bf4..d3df624 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,11 +1,16 @@
# Every pull request and every push to main: typecheck, tests and the app's
# build, on macOS, Linux and Windows, so a change can't break one of them unnoticed.
+# Windows runs the same tests several times slower, so they're split across four
+# runners there. A pull request runs the heaviest randomized tests with fewer rounds
+# (TUCANO_QUICK_TESTS); main runs them all.
name: CI
on:
pull_request:
+ paths-ignore: ['site/**', 'docs/**', '**/*.md']
push:
branches: [main]
+ paths-ignore: ['site/**', 'docs/**', '**/*.md']
permissions:
contents: read
@@ -16,22 +21,36 @@ concurrency:
jobs:
test:
- name: ${{ matrix.os }}
+ name: ${{ matrix.os }}${{ matrix.shard != '1/1' && format(' ({0})', matrix.shard) || '' }}
strategy:
fail-fast: false
matrix:
- os: [macos-latest, ubuntu-latest, windows-latest]
+ include:
+ - { os: macos-latest, shard: 1/1 }
+ - { os: ubuntu-latest, shard: 1/1 }
+ - { os: windows-latest, shard: 1/4 }
+ - { os: windows-latest, shard: 2/4 }
+ - { os: windows-latest, shard: 3/4 }
+ - { os: windows-latest, shard: 4/4 }
runs-on: ${{ matrix.os }}
env:
# The tests and the build don't run Electron itself.
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
+ TUCANO_QUICK_TESTS: ${{ github.event_name == 'pull_request' && '1' || '' }}
steps:
+ # Defender scans every file the tests write (databases, temp folders), which is
+ # most of Windows' extra time. The runner is thrown away after the job.
+ - if: runner.os == 'Windows'
+ run: Add-MpPreference -ExclusionPath $env:GITHUB_WORKSPACE, $env:RUNNER_TEMP, $env:TEMP, "$env:USERPROFILE\AppData\Local\npm-cache"
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- run: npm ci
- - run: npm run typecheck
- - run: npm test
- - run: npm run build
+ - if: matrix.shard == '1/1' || matrix.shard == '1/4'
+ run: npm run typecheck
+ - run: npx vitest run --shard=${{ matrix.shard }}
+ - if: matrix.shard == '1/1' || matrix.shard == '1/4'
+ run: npm run build
+
diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml
new file mode 100644
index 0000000..918e51c
--- /dev/null
+++ b/.github/workflows/site.yml
@@ -0,0 +1,22 @@
+# The site's own tests (the waitlist worker), with Node's test runner, when the site changes.
+name: Site
+
+on:
+ pull_request:
+ paths: ['site/**', '.github/workflows/site.yml']
+ push:
+ branches: [main]
+ paths: ['site/**', '.github/workflows/site.yml']
+
+permissions:
+ contents: read
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-node@v7
+ with:
+ node-version: 24
+ - run: node --test site/*.test.mjs
diff --git a/test/team-round2.test.ts b/test/team-round2.test.ts
index 039c1b1..f5121f8 100644
--- a/test/team-round2.test.ts
+++ b/test/team-round2.test.ts
@@ -475,7 +475,8 @@ describe('12. unread right after upgrading from main', () => {
const rnd = (n: number): number => ((seed = (seed * 1103515245 + 12345) % 2 ** 31), seed % n)
const mismatches: string[] = []
// Each round builds a database on disk: Windows' disk is slow enough that fewer rounds keep it in time.
- const rounds = process.platform === 'win32' ? 20 : 150
+ // A pull request's CI runs a few (TUCANO_QUICK_TESTS); main runs them all.
+ const rounds = process.env['TUCANO_QUICK_TESTS'] ? 5 : process.platform === 'win32' ? 20 : 150
for (let round = 0; round < rounds; round++) {
const file = join(dir(), 'tucano.db')
const raw = new DatabaseSync(file)
diff --git a/vitest.config.ts b/vitest.config.ts
index 17a8977..18e13b9 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -1,7 +1,12 @@
-import { defineConfig } from 'vitest/config'
+import { configDefaults, defineConfig } from 'vitest/config'
// On Windows, tests that write a lot to SQLite run several times slower (the summary
// tests took 6 s on GitHub's runner), so they get more time there than vitest's 5 s.
+// site/ has its own node:test files (`node --test site/`), which vitest can't run.
export default defineConfig({
- test: { testTimeout: process.platform === 'win32' ? 30_000 : 5_000, hookTimeout: process.platform === 'win32' ? 30_000 : 10_000 }
+ test: {
+ exclude: [...configDefaults.exclude, 'site/**'],
+ testTimeout: process.platform === 'win32' ? 30_000 : 5_000,
+ hookTimeout: process.platform === 'win32' ? 30_000 : 10_000
+ }
})