@@ -77,12 +77,17 @@ jobs:
7777 - name : Format check
7878 run : pnpm run fmt:check
7979
80- test :
81- name : Test
80+ test_shard :
81+ name : Test shard (${{ matrix.shard }}/4)
8282 runs-on : ubuntu-latest
83+ strategy :
84+ fail-fast : false
85+ matrix :
86+ shard : [1, 2, 3, 4]
8387 # Unit tests run via vitest in node/jsdom and never launch the Electron
84- # runtime, so skip the flaky Chromium binary download. Native node modules
85- # (better-sqlite3, node-pty) are still built by the install scripts below.
88+ # runtime, so skip the flaky Chromium binary download and the root
89+ # postinstall, which rebuilds better-sqlite3 for Electron. The database
90+ # tests need Node-ABI better-sqlite3 and node-pty bindings rebuilt below.
8691 # ELECTRON_OVERRIDE_DIST_PATH lets `require("electron")` resolve to a path
8792 # string without the binary present, so suites that import the module (but
8893 # never spawn it) load instead of throwing from electron/index.js.
@@ -103,19 +108,19 @@ jobs:
103108 cache : pnpm
104109
105110 - name : Install dependencies
106- run : |
107- for attempt in 1 2 3; do
108- if pnpm install --frozen-lockfile; then
109- exit 0
110- fi
111- echo "::warning::pnpm install failed on attempt $attempt; retrying in 15s"
112- sleep 15
113- done
114- echo "::error::pnpm install failed after 3 attempts"
115- exit 1
116-
117- - name : Ensure native dependencies
118- run : node scripts/ensure-native-deps.mjs
119-
120- - name : Test
121- run : pnpm run test
111+ run : pnpm install --frozen-lockfile --ignore-scripts
112+
113+ - name : Build test native dependencies
114+ run : pnpm rebuild better-sqlite3 node-pty
115+
116+ - name : Test shard
117+ run : pnpm run test --shard=${{ matrix.shard }}/4
118+
119+ test :
120+ name : Test
121+ if : ${{ always() }}
122+ needs : test_shard
123+ runs-on : ubuntu-latest
124+ steps :
125+ - name : Verify test shards
126+ run : test "${{ needs.test_shard.result }}" = "success"
0 commit comments