Skip to content

Commit f600ab9

Browse files
committed
chore(ci): attempt at optimising slow actions
1 parent c601739 commit f600ab9

6 files changed

Lines changed: 47 additions & 58 deletions

File tree

.github/workflows/e2e-webapp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
e2eTests:
1616
name: "🧪 E2E Tests: Webapp"
17-
runs-on: warp-ubuntu-latest-x64-8x
17+
runs-on: warp-ubuntu-latest-x64-16x
1818
timeout-minutes: 20
1919
env:
2020
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [warp-ubuntu-latest-x64-4x, warp-windows-latest-x64-4x]
23+
os: [warp-ubuntu-latest-x64-4x, warp-windows-latest-x64-8x]
2424
package-manager: ["npm", "pnpm"]
2525
steps:
2626
- name: ⬇️ Checkout repo

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
4949
release:
5050
name: 🚀 Release npm packages
51-
runs-on: ubuntu-latest
51+
runs-on: ubuntu-latest # this cannot run on non-GH runner
5252
environment: npm-publish
5353
permissions:
5454
contents: write
@@ -281,7 +281,7 @@ jobs:
281281
# The prerelease job needs to be on the same workflow file due to a limitation related to how npm verifies OIDC claims.
282282
prerelease:
283283
name: 🧪 Prerelease
284-
runs-on: ubuntu-latest
284+
runs-on: ubuntu-latest # this cannot run on non-GH runner
285285
environment: npm-publish
286286
permissions:
287287
contents: read

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88

99
jobs:
1010
typecheck:
11-
runs-on: warp-ubuntu-latest-x64-8x
11+
runs-on: warp-ubuntu-latest-x64-16x
1212

1313
steps:
1414
- name: ⬇️ Checkout repo

.github/workflows/unit-tests-internal.yml

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ on:
1414
jobs:
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

.github/workflows/unit-tests-webapp.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ on:
1414
jobs:
1515
unitTests:
1616
name: "🧪 Unit Tests: Webapp"
17-
runs-on: warp-ubuntu-latest-x64-8x
17+
# 3 shards on 32x machines instead of 10 on 8x: webapp tests run files in parallel
18+
# (forks pool scales with cores) and are genuinely CPU-hungry, so keep aggregate
19+
# compute similar while paying the setup cost (install, prisma generate, image pulls)
20+
# 3 times instead of 10.
21+
runs-on: warp-ubuntu-latest-x64-32x
1822
strategy:
1923
# one flaky shard shouldn't cancel its siblings - lets us re-run only the failed shard
2024
fail-fast: false
2125
matrix:
22-
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
23-
shardTotal: [10]
26+
shardIndex: [1, 2, 3]
27+
shardTotal: [3]
2428
env:
2529
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
2630
SHARD_INDEX: ${{ matrix.shardIndex }}

0 commit comments

Comments
 (0)