Skip to content

Commit 49fa84a

Browse files
committed
improvement(ci): run database checks alongside application shards
1 parent ce16942 commit 49fa84a

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

‎.github/workflows/checks.yml‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ jobs:
7070
#
7171
# The two paths build different schemas (migrations add triggers, checks and NOT VALID
7272
# constraints that `db:push` does not), so each runs the whole suite. Vitest splits each
73-
# suite's files across eight shards by measured duration (DurationBalancedSequencer in vitest.shared.ts); a
74-
# shard runs its files one at a time against its own database.
75-
name: integration (${{ matrix.provision }}, ${{ matrix.shard }}/8)
73+
# application's files across eight shards by measured duration (DurationBalancedSequencer in
74+
# vitest.shared.ts). Database-package checks run alongside them, so their longest files do
75+
# not delay application tests. Each job has its own database.
76+
name: integration (${{ matrix.provision }}, ${{ matrix.shard == 'db' && 'db' || format('{0}/8', matrix.shard) }})
7677
needs: changes
7778
if: needs.changes.outputs.integration == 'true'
7879
runs-on: ubuntu-24.04
@@ -81,7 +82,7 @@ jobs:
8182
fail-fast: false
8283
matrix:
8384
provision: [push, migrate]
84-
shard: [1, 2, 3, 4, 5, 6, 7, 8]
85+
shard: [db, 1, 2, 3, 4, 5, 6, 7, 8]
8586
services:
8687
redis:
8788
image: redis:8.2-alpine
@@ -105,9 +106,9 @@ jobs:
105106
--health-interval 5s
106107
--health-timeout 5s
107108
--health-retries 10
108-
# Only push/6 runs the PostgreSQL 16 step below; an empty image skips the service elsewhere.
109+
# Only push/db runs the PostgreSQL 16 step below; an empty image skips the service elsewhere.
109110
postgres-legacy:
110-
image: ${{ matrix.provision == 'push' && matrix.shard == 6 && 'postgres:16-alpine' || '' }}
111+
image: ${{ matrix.provision == 'push' && matrix.shard == 'db' && 'postgres:16-alpine' || '' }}
111112
env:
112113
POSTGRES_USER: postgres
113114
POSTGRES_PASSWORD: postgres
@@ -143,31 +144,30 @@ jobs:
143144
bun run db:${{ matrix.provision }}
144145
145146
- name: Verify migration replay is a no-op
146-
if: matrix.provision == 'migrate' && matrix.shard == 6
147+
if: matrix.provision == 'migrate' && matrix.shard == 'db'
147148
working-directory: packages/db
148149
run: bun run db:migrate
149150

150151
- name: Run packages/db integration tests
152+
if: matrix.shard == 'db'
151153
working-directory: packages/db
152-
# Oppose the longest database shard and the longest application shard.
153-
env:
154-
SHARD: ${{ matrix.shard }}
155-
run: bun run test --mode integration --shard=$((9 - SHARD))/8
154+
run: bun run test --mode integration
156155

157156
- name: Run apps/sim integration tests
157+
if: matrix.shard != 'db'
158158
working-directory: apps/sim
159159
# A non-UTC process zone keeps timestamp-without-time-zone handling honest.
160160
env:
161161
TZ: America/Los_Angeles
162162
run: bun run test --mode integration --shard=${{ matrix.shard }}/8
163163

164164
- name: Run apps/realtime integration tests
165-
if: matrix.shard == 6
165+
if: matrix.shard == 'db'
166166
working-directory: apps/realtime
167167
run: bun run test --mode integration
168168

169169
- name: Verify cumulative billing timeout recovery on PostgreSQL 16
170-
if: matrix.provision == 'push' && matrix.shard == 6
170+
if: matrix.provision == 'push' && matrix.shard == 'db'
171171
working-directory: apps/sim
172172
env:
173173
TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5433/sim_test

0 commit comments

Comments
 (0)