Skip to content

Commit a1c28f4

Browse files
wesbillmanPinky
andauthored
Shard desktop Playwright CI jobs (#992)
Signed-off-by: Wes <[email protected]> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
1 parent 179c968 commit a1c28f4

1 file changed

Lines changed: 137 additions & 32 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 137 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ jobs:
9191
- name: Unit tests
9292
run: just test-unit
9393

94-
desktop:
95-
name: Desktop
94+
desktop-core:
95+
name: Desktop Core
9696
runs-on: ubuntu-latest
9797
timeout-minutes: 45
9898
needs: [changes]
@@ -142,34 +142,12 @@ jobs:
142142
restore-keys: pnpm-${{ runner.os }}-
143143
- name: Install desktop dependencies
144144
run: just desktop-install-ci
145-
- name: Get Playwright version
146-
id: pw-version
147-
run: echo "version=$(cd desktop && node -e "console.log(require('@playwright/test/package.json').version)")" >> "$GITHUB_OUTPUT"
148-
- name: Restore Playwright browser cache
149-
id: playwright-cache
150-
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
151-
with:
152-
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
153-
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
154-
- name: Install Playwright Chromium
155-
if: steps.playwright-cache.outputs.cache-hit != 'true'
156-
run: cd desktop && pnpm exec playwright install chromium
157-
- name: Install Playwright system dependencies
158-
run: cd desktop && pnpm exec playwright install-deps chromium
159-
- name: Save Playwright browser cache
160-
if: steps.playwright-cache.outputs.cache-hit != 'true' && github.event_name == 'push'
161-
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
162-
with:
163-
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
164-
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
165145
- name: Desktop lint and format
166146
run: just desktop-check
167147
- name: Desktop unit tests
168148
run: just desktop-test
169149
- name: Desktop build
170150
run: just desktop-build
171-
- name: Desktop smoke e2e
172-
run: cd desktop && pnpm exec playwright test --project=smoke
173151
- name: Desktop Tauri check
174152
run: just desktop-tauri-check
175153
env:
@@ -194,10 +172,91 @@ jobs:
194172
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
195173
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
196174

197-
desktop-e2e-integration:
198-
name: Desktop E2E Integration
175+
desktop-smoke-e2e:
176+
name: Desktop Smoke E2E (${{ matrix.shard }})
199177
runs-on: ubuntu-latest
200-
timeout-minutes: 45
178+
timeout-minutes: 20
179+
needs: [changes]
180+
if: github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true'
181+
strategy:
182+
fail-fast: false
183+
matrix:
184+
shard: [1, 2, 3, 4]
185+
permissions:
186+
contents: read
187+
steps:
188+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
189+
- uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
190+
- name: Get pnpm store directory
191+
id: pnpm-cache
192+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
193+
- name: Restore pnpm store cache
194+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
195+
with:
196+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
197+
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
198+
restore-keys: pnpm-${{ runner.os }}-
199+
- name: Install desktop dependencies
200+
run: just desktop-install-ci
201+
- name: Get Playwright version
202+
id: pw-version
203+
run: echo "version=$(cd desktop && node -e "console.log(require('@playwright/test/package.json').version)")" >> "$GITHUB_OUTPUT"
204+
- name: Restore Playwright browser cache
205+
id: playwright-cache
206+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
207+
with:
208+
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
209+
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
210+
- name: Install Playwright Chromium
211+
if: steps.playwright-cache.outputs.cache-hit != 'true'
212+
run: cd desktop && pnpm exec playwright install chromium
213+
- name: Install Playwright system dependencies
214+
run: cd desktop && pnpm exec playwright install-deps chromium
215+
- name: Save Playwright browser cache
216+
if: steps.playwright-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && matrix.shard == 1
217+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
218+
with:
219+
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
220+
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
221+
- name: Desktop build
222+
run: just desktop-build
223+
- name: Desktop smoke e2e
224+
run: cd desktop && pnpm exec playwright test --project=smoke --shard=${{ matrix.shard }}/4
225+
- name: Upload desktop smoke e2e artifacts
226+
if: failure()
227+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
228+
with:
229+
name: desktop-smoke-e2e-artifacts-${{ matrix.shard }}
230+
path: |
231+
desktop/playwright-report
232+
desktop/test-results
233+
if-no-files-found: ignore
234+
235+
desktop:
236+
name: Desktop
237+
runs-on: ubuntu-latest
238+
timeout-minutes: 5
239+
needs: [changes, desktop-core, desktop-smoke-e2e]
240+
if: always() && (github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true')
241+
permissions:
242+
contents: read
243+
steps:
244+
- name: Check desktop jobs
245+
run: |
246+
if [ "${{ needs.desktop-core.result }}" != "success" ]; then
247+
echo "Desktop Core finished with: ${{ needs.desktop-core.result }}"
248+
exit 1
249+
fi
250+
if [ "${{ needs.desktop-smoke-e2e.result }}" != "success" ]; then
251+
echo "Desktop Smoke E2E shards finished with: ${{ needs.desktop-smoke-e2e.result }}"
252+
exit 1
253+
fi
254+
echo "Desktop jobs passed"
255+
256+
desktop-e2e-relay:
257+
name: Desktop E2E Relay
258+
runs-on: ubuntu-latest
259+
timeout-minutes: 10
201260
needs: [changes]
202261
if: github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true'
203262
permissions:
@@ -211,6 +270,31 @@ jobs:
211270
.
212271
desktop/src-tauri
213272
save-if: ${{ github.event_name != 'pull_request' }}
273+
- name: Build relay
274+
run: cargo build --profile ci -p buzz-relay
275+
- name: Upload relay binary
276+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
277+
with:
278+
name: desktop-e2e-relay
279+
path: target/ci/buzz-relay
280+
if-no-files-found: error
281+
retention-days: 1
282+
283+
desktop-e2e-integration-shard:
284+
name: Desktop E2E Integration (${{ matrix.shard }}/2)
285+
runs-on: ubuntu-latest
286+
timeout-minutes: 20
287+
needs: [changes, desktop-e2e-relay]
288+
if: github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true'
289+
strategy:
290+
fail-fast: false
291+
matrix:
292+
shard: [1, 2]
293+
permissions:
294+
contents: read
295+
steps:
296+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
297+
- uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
214298
- name: Start integration services
215299
run: docker compose up -d postgres redis typesense minio minio-init
216300
- name: Get pnpm store directory
@@ -239,7 +323,7 @@ jobs:
239323
- name: Install Playwright system dependencies
240324
run: cd desktop && pnpm exec playwright install-deps chromium
241325
- name: Save Playwright browser cache
242-
if: steps.playwright-cache.outputs.cache-hit != 'true' && github.event_name == 'push'
326+
if: steps.playwright-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && matrix.shard == 1
243327
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
244328
with:
245329
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
@@ -274,10 +358,14 @@ jobs:
274358
PGUSER: buzz
275359
PGPASSWORD: buzz_dev
276360
PGDATABASE: buzz
277-
- name: Build relay
278-
run: cargo build --profile ci -p buzz-relay
361+
- name: Download relay binary
362+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
363+
with:
364+
name: desktop-e2e-relay
365+
path: target/ci
279366
- name: Start relay
280367
run: |
368+
chmod +x ./target/ci/buzz-relay
281369
nohup env \
282370
DATABASE_URL=postgres://buzz:buzz_dev@localhost:5432/buzz \
283371
REDIS_URL=redis://localhost:6379 \
@@ -306,12 +394,12 @@ jobs:
306394
- name: Seed desktop e2e data
307395
run: bash scripts/setup-desktop-test-data.sh
308396
- name: Desktop relay-backed e2e
309-
run: cd desktop && pnpm exec playwright test --project=integration
397+
run: cd desktop && pnpm exec playwright test --project=integration --shard=${{ matrix.shard }}/2
310398
- name: Upload desktop integration artifacts
311399
if: failure()
312400
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
313401
with:
314-
name: desktop-e2e-integration-artifacts
402+
name: desktop-e2e-integration-artifacts-${{ matrix.shard }}
315403
path: |
316404
desktop/playwright-report
317405
desktop/test-results
@@ -324,6 +412,23 @@ jobs:
324412
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
325413
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
326414

415+
desktop-e2e-integration:
416+
name: Desktop E2E Integration
417+
runs-on: ubuntu-latest
418+
timeout-minutes: 5
419+
needs: [changes, desktop-e2e-integration-shard]
420+
if: always() && (github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true')
421+
permissions:
422+
contents: read
423+
steps:
424+
- name: Check integration shards
425+
run: |
426+
if [ "${{ needs.desktop-e2e-integration-shard.result }}" != "success" ]; then
427+
echo "Desktop E2E Integration shards finished with: ${{ needs.desktop-e2e-integration-shard.result }}"
428+
exit 1
429+
fi
430+
echo "Desktop E2E Integration shards passed"
431+
327432
web:
328433
name: Web
329434
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)