@@ -147,53 +147,26 @@ jobs:
147147 timeout-minutes : 15
148148 strategy :
149149 fail-fast : false
150+ # Each package's actual `pnpm test` step runs only a few seconds, while
151+ # every matrix job pays ~50s of fixed overhead (service container init
152+ # dominates). Batch packages into a few jobs that run tests sequentially
153+ # against one shared Postgres container to amortize that overhead.
150154 matrix :
151155 include :
152- - package : pgpm/core
153- env : {}
154- - package : pgpm/cli
155- env : {}
156- - package : packages/client
157- env :
158- TEST_DATABASE_URL : postgres://postgres:password@localhost:5432/postgres
159- - package : packages/safegres
160- env : {}
161- - package : postgres/pg-codegen
162- env : {}
163- - package : postgres/pgsql-test
164- env : {}
165- - package : postgres/drizzle-orm-test
166- env : {}
167- - package : postgres/introspectron
168- env : {}
169- - package : graphile/graphile-test
170- env : {}
171- - package : graphile/graphile-connection-filter
172- env : {}
173- - package : graphile/graphile-postgis
174- env : {}
175- - package : graphile/graphile-search
176- env : {}
177- - package : graphile/graphile-ltree
178- env : {}
179- - package : graphile/graphile-bulk-mutations
180- env : {}
181- - package : graphile/graphile-function-bindings
182- env : {}
183- - package : graphql/orm-test
184- env : {}
185- - package : graphql/test
186- env : {}
187- - package : graphql/playwright-test
188- env : {}
189- - package : jobs/knative-job-service
190- env : {}
156+ - batch : pg-core
157+ packages : ' pgpm/core pgpm/cli jobs/knative-job-service packages/client packages/safegres postgres/pg-codegen'
158+ - batch : pg-postgres
159+ packages : ' postgres/pgsql-test postgres/drizzle-orm-test postgres/introspectron graphile/graphile-test graphile/graphile-connection-filter graphile/graphile-postgis'
160+ - batch : pg-graphql
161+ packages : ' graphile/graphile-search graphile/graphile-ltree graphile/graphile-bulk-mutations graphile/graphile-function-bindings graphql/orm-test graphql/test graphql/playwright-test'
191162
192163 env :
193164 PGHOST : localhost
194165 PGPORT : 5432
195166 PGUSER : postgres
196167 PGPASSWORD : password
168+ # packages/client reads TEST_DATABASE_URL; harmless for the others.
169+ TEST_DATABASE_URL : postgres://postgres:password@localhost:5432/postgres
197170 # Pin an explicit heap cap: on smaller runners Node's memory-derived
198171 # default can land near ~2GB and OOM Jest.
199172 NODE_OPTIONS : ' --max-old-space-size=4096'
@@ -206,9 +179,9 @@ jobs:
206179 POSTGRES_PASSWORD : password
207180 options : >-
208181 --health-cmd "pg_isready -U postgres"
209- --health-interval 10s
182+ --health-interval 3s
210183 --health-timeout 5s
211- --health-retries 5
184+ --health-retries 10
212185 ports :
213186 - 5432:5432
214187
@@ -253,9 +226,13 @@ jobs:
253226 - name : Install pgpm fixture modules
254227 run : pnpm fixtures:install
255228
256- - name : Test ${{ matrix.package }}
257- run : cd ./${{ matrix.package }} && pnpm test
258- env : ${{ matrix.env }}
229+ - name : Test ${{ matrix.batch }}
230+ run : |
231+ for pkg in ${{ matrix.packages }}; do
232+ echo "::group::Testing $pkg"
233+ (cd ./$pkg && pnpm test)
234+ echo "::endgroup::"
235+ done
259236
260237 # =========================================================================
261238 # TIER 3 – Integration tests (PostgreSQL + MinIO)
@@ -266,29 +243,14 @@ jobs:
266243 timeout-minutes : 15
267244 strategy :
268245 fail-fast : false
246+ # Batched to amortize per-job fixed overhead (service container init
247+ # dominates) — see the pg-tests tier for rationale.
269248 matrix :
270249 include :
271- - package : pgpm/env
272- env : {}
273- - package : uploads/s3-streamer
274- env :
275- BUCKET_NAME : test-bucket
276- - package : packages/upload-client
277- env : {}
278- - package : packages/bucket-provisioner
279- env : {}
280- - package : graphile/graphile-settings
281- env : {}
282- - package : graphile/graphile-presigned-url-plugin
283- env : {}
284- - package : graphile/graphile-bucket-provisioner-plugin
285- env : {}
286- - package : graphql/server-test
287- env : {}
288- - package : graphql/env
289- env : {}
290- - package : graphql/server
291- env : {}
250+ - batch : integration-graphql
251+ packages : ' graphql/server-test graphql/server graphql/env pgpm/env'
252+ - batch : integration-uploads
253+ packages : ' uploads/s3-streamer packages/upload-client packages/bucket-provisioner graphile/graphile-settings graphile/graphile-presigned-url-plugin graphile/graphile-bucket-provisioner-plugin'
292254
293255 env :
294256 PGHOST : localhost
@@ -299,6 +261,8 @@ jobs:
299261 AWS_ACCESS_KEY : minioadmin
300262 AWS_SECRET_KEY : minioadmin
301263 AWS_REGION : us-east-1
264+ # uploads/s3-streamer reads BUCKET_NAME; harmless for the others.
265+ BUCKET_NAME : test-bucket
302266 # Pin an explicit heap cap: on smaller runners Node's memory-derived
303267 # default can land near ~2GB and OOM Jest.
304268 NODE_OPTIONS : ' --max-old-space-size=4096'
@@ -311,9 +275,9 @@ jobs:
311275 POSTGRES_PASSWORD : password
312276 options : >-
313277 --health-cmd "pg_isready -U postgres"
314- --health-interval 10s
278+ --health-interval 3s
315279 --health-timeout 5s
316- --health-retries 5
280+ --health-retries 10
317281 ports :
318282 - 5432:5432
319283
@@ -327,9 +291,9 @@ jobs:
327291 - 9001:9001
328292 options : >-
329293 --health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1"
330- --health-interval 10s
294+ --health-interval 3s
331295 --health-timeout 5s
332- --health-retries 5
296+ --health-retries 10
333297
334298 steps :
335299 - name : Download workspace
@@ -372,9 +336,13 @@ jobs:
372336 - name : Install pgpm fixture modules
373337 run : pnpm fixtures:install
374338
375- - name : Test ${{ matrix.package }}
376- run : cd ./${{ matrix.package }} && pnpm test
377- env : ${{ matrix.env }}
339+ - name : Test ${{ matrix.batch }}
340+ run : |
341+ for pkg in ${{ matrix.packages }}; do
342+ echo "::group::Testing $pkg"
343+ (cd ./$pkg && pnpm test)
344+ echo "::endgroup::"
345+ done
378346
379347 # =========================================================================
380348 # TIER 4 – AI integration tests (PostgreSQL + Ollama)
@@ -407,9 +375,9 @@ jobs:
407375 POSTGRES_PASSWORD : password
408376 options : >-
409377 --health-cmd "pg_isready -U postgres"
410- --health-interval 10s
378+ --health-interval 3s
411379 --health-timeout 5s
412- --health-retries 5
380+ --health-retries 10
413381 ports :
414382 - 5432:5432
415383
0 commit comments