1414jobs :
1515 unitTests :
1616 name : " 🧪 Unit Tests: Internal"
17- runs-on : warp-ubuntu-latest-x64-8x
18- strategy :
19- # one flaky shard shouldn't cancel its siblings - lets us re-run only the failed shard
20- fail-fast : false
21- matrix :
22- shardIndex : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
23- shardTotal : [12]
17+ # Single big machine instead of a 12-job matrix: the internal suites are serial
18+ # (fileParallelism: false) and container-wait-bound, so 12 in-machine shard processes
19+ # fit comfortably in 32 vCPUs while paying the setup cost (install, prisma generate,
20+ # image pulls) once instead of 12 times.
21+ runs-on : warp-ubuntu-latest-x64-32x
2422 env :
2523 DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
26- SHARD_INDEX : ${{ matrix.shardIndex }}
27- SHARD_TOTAL : ${{ matrix.shardTotal }}
24+ SHARD_TOTAL : 12
2825 steps :
2926 - name : 🔧 Disable IPv6
3027 run : |
@@ -108,8 +105,34 @@ jobs:
108105 - name : 📀 Generate Prisma Client
109106 run : pnpm run generate
110107
111- - name : 🧪 Run Internal Unit Tests
112- run : pnpm run test:internal --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --passWithNoTests
108+ - name : 🏗️ Build test dependencies
109+ # Build once up-front so the parallel shard runs below (turbo --only) never race
110+ # to build or cache-restore the same outputs concurrently.
111+ run : pnpm exec turbo run build --filter "@internal/*..."
112+
113+ - name : 🧪 Run Internal Unit Tests (${{ env.SHARD_TOTAL }} in-machine shards)
114+ run : |
115+ # Same shard partitioning as the old 12-job matrix (DurationShardingSequencer
116+ # keys off --shard=i/N), but as parallel local processes. --only skips the
117+ # ^build dependency handled by the step above.
118+ status=0
119+ declare -a pids
120+ for i in $(seq 1 "$SHARD_TOTAL"); do
121+ pnpm exec turbo run test --only --concurrency=1 --filter "@internal/*" -- \
122+ --run --reporter=default --reporter=blob --shard="$i/$SHARD_TOTAL" --passWithNoTests \
123+ > "/tmp/internal-shard-$i.log" 2>&1 &
124+ pids[$i]=$!
125+ done
126+ for i in $(seq 1 "$SHARD_TOTAL"); do
127+ if ! wait "${pids[$i]}"; then
128+ status=1
129+ echo "::error::internal unit test shard $i/$SHARD_TOTAL failed"
130+ fi
131+ echo "::group::🧪 shard $i/$SHARD_TOTAL"
132+ cat "/tmp/internal-shard-$i.log"
133+ echo "::endgroup::"
134+ done
135+ exit "$status"
113136
114137 - name : Gather all reports
115138 if : ${{ !cancelled() }}
@@ -118,44 +141,6 @@ jobs:
118141 find . -type f -path '*/.vitest-reports/blob-*.json' \
119142 -exec bash -c 'src="$1"; basename=$(basename "$src"); pkg=$(dirname "$src" | sed "s|^\./||;s|/\.vitest-reports$||;s|/|_|g"); cp "$src" ".vitest-reports/${pkg}-${basename}"' _ {} \;
120143
121- - name : Upload blob reports to GitHub Actions Artifacts
144+ - name : 📊 Merge reports
122145 if : ${{ !cancelled() }}
123- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
124- with :
125- name : internal-blob-report-${{ matrix.shardIndex }}
126- path : .vitest-reports/*
127- include-hidden-files : true
128- retention-days : 1
129-
130- merge-reports :
131- name : " 📊 Merge Reports"
132- if : ${{ !cancelled() }}
133- needs : [unitTests]
134- runs-on : warp-ubuntu-latest-x64-2x
135- steps :
136- - name : ⬇️ Checkout repo
137- uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
138- with :
139- fetch-depth : 1
140- persist-credentials : false
141-
142- - name : ⎔ Setup pnpm
143- uses : pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
144- with :
145- version : 10.33.2
146-
147- - name : ⎔ Setup node
148- uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
149- with :
150- node-version : 22.23.1
151- # no cache enabled, we're not installing deps
152-
153- - name : Download blob reports from GitHub Actions Artifacts
154- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
155- with :
156- path : .vitest-reports
157- pattern : internal-blob-report-*
158- merge-multiple : true
159-
160- - name : Merge reports
161146 run : pnpm dlx vitest@4.1.7 run --merge-reports --pass-with-no-tests
0 commit comments