Skip to content

Commit 68eb1e5

Browse files
committed
shard unit tests
1 parent 1bb1fc4 commit 68eb1e5

File tree

1 file changed

+52
-3
lines changed

1 file changed

+52
-3
lines changed

.github/workflows/unit-tests.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ jobs:
1010
unitTests:
1111
name: "🧪 Unit Tests"
1212
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
shardIndex: [1, 2, 3, 4, 5]
16+
shardTotal: [5]
1317
env:
1418
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
19+
SHARD_INDEX: ${{ matrix.shardIndex }}
20+
SHARD_TOTAL: ${{ matrix.shardTotal }}
1521
steps:
1622
- name: 🔧 Disable IPv6
1723
run: |
@@ -73,7 +79,7 @@ jobs:
7379
run: pnpm run generate
7480

7581
- name: 🧪 Run Webapp Unit Tests
76-
run: pnpm run test:webapp
82+
run: pnpm run test:webapp -- --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
7783
env:
7884
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
7985
DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
@@ -82,7 +88,50 @@ jobs:
8288
ENCRYPTION_KEY: "secret"
8389

8490
- name: 🧪 Run Package Unit Tests
85-
run: pnpm run test:packages
91+
run: pnpm run test:packages -- --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
8692

8793
- name: 🧪 Run Internal Unit Tests
88-
run: pnpm run test:internal
94+
run: pnpm run test:internal -- --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
95+
96+
- name: Upload blob report to GitHub Actions Artifacts
97+
if: ${{ !cancelled() }}
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: blob-report-${{ matrix.shardIndex }}
101+
path: .vitest-reports/*
102+
include-hidden-files: true
103+
retention-days: 1
104+
105+
merge-reports:
106+
if: ${{ !cancelled() }}
107+
needs: [unitTests]
108+
runs-on: ubuntu-latest
109+
steps:
110+
- name: ⬇️ Checkout repo
111+
uses: actions/checkout@v4
112+
with:
113+
fetch-depth: 0
114+
115+
- name: ⎔ Setup pnpm
116+
uses: pnpm/action-setup@v4
117+
with:
118+
version: 8.15.5
119+
120+
- name: ⎔ Setup node
121+
uses: buildjet/setup-node@v4
122+
with:
123+
node-version: 20.11.1
124+
cache: "pnpm"
125+
126+
- name: 📥 Download deps
127+
run: pnpm install --frozen-lockfile
128+
129+
- name: Download blob reports from GitHub Actions Artifacts
130+
uses: actions/download-artifact@v4
131+
with:
132+
path: .vitest-reports
133+
pattern: blob-report-*
134+
merge-multiple: true
135+
136+
- name: Merge reports
137+
run: npx vitest --merge-reports

0 commit comments

Comments
 (0)