1313
1414# Avoid running multiple PR builders for the same PR on subsequent pushes.
1515concurrency :
16- group : ${{ github.workflow }}-${{ github.ref }}
16+ group : ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
1717 cancel-in-progress : true
1818
1919env :
4646 working-directory : frontend
4747 run : |
4848 echo "🔍 Running pnpm audit for frontend dependencies..."
49- IGNORE_ARGS=()
50- while IFS= read -r id; do
51- IGNORE_ARGS+=(--ignore "$id")
52- done < <(jq -r '.frontend[].id' "$GITHUB_WORKSPACE/.audit-ignore.json")
49+ # CVE ignores are managed via auditConfig.ignoreCves in pnpm-workspace.yaml
5350 # Remove `--ignore-registry-errors` once pnpm 11 is generally available. Tracker: https://github.com/pnpm/pnpm/issues/11265
54- pnpm audit --ignore-registry-errors --audit-level=high "${IGNORE_ARGS[@]}"
51+ pnpm audit --ignore-registry-errors --audit-level=high
5552
5653 - name : 🔍 Run npm audit (E2E Tests)
5754 working-directory : tests/e2e
@@ -336,16 +333,12 @@ jobs:
336333 if : steps.filter.outputs.code != 'true'
337334 run : echo "Only documentation changes detected - skipping frontend and E2E tests"
338335
339- test-frontend :
340- name : 🧪 Frontend Tests (shard ${{ matrix.shard }}/4)
336+ test-frontend-packages :
337+ name : 🧪 Frontend Package & Gate Tests
341338 needs : [detect-code-changes]
342339 if : ${{ always() && (github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'merge_group') && (needs.detect-code-changes.result == 'skipped' || needs.detect-code-changes.outputs.should-run == 'true') }}
343340 runs-on : ubuntu-latest
344341 timeout-minutes : 30
345- strategy :
346- fail-fast : false
347- matrix :
348- shard : [1, 2, 3, 4]
349342 steps :
350343 - name : 📥 Checkout Code
351344 uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -369,37 +362,85 @@ jobs:
369362 run : |
370363 pnpm build:frontend
371364
372- - name : 🧪 Run Console Tests with Coverage
365+ - name : 🎭 Install Playwright Browsers
366+ run : pnpm exec playwright install chromium
367+
368+ - name : 🧪 Run Tests for Frontend Packages
373369 run : |
374- cd frontend/apps/console
375- pnpm vitest run --coverage --shard=${{ matrix.shard }}/4
370+ cd frontend
371+ pnpm test:packages
376372
377373 - name : 🧪 Run Gate Tests with Coverage
378- if : matrix.shard == 1
379374 run : |
380375 cd frontend/apps/gate
381376 pnpm test:coverage
382377
383- # TODO: Enable package tests in CI once the broken tests are fixed
378+ # Strip branch data (BRDA/BRF/BRH) from frontend LCOV reports before uploading.
379+ # React Compiler (babel-plugin-react-compiler) generates phantom branch points in compiled
380+ # output that inflate the partial-line count in Codecov's coverage calculation.
381+ # This is a known upstream issue: https://github.com/facebook/react/issues/32950
382+ # Line and function coverage remain unaffected and accurately reflect test quality.
383+ - name : 🧹 Strip branch data from gate LCOV report
384+ run : |
385+ if [ -f "frontend/apps/gate/coverage/lcov.info" ]; then
386+ sed -i '/^BRDA:/d;/^BRF:/d;/^BRH:/d' "frontend/apps/gate/coverage/lcov.info"
387+ fi
384388
385- # - name: 🧪 Run Packages Tests with Coverage
386- # if: matrix.shard == 1
387- # run: |
388- # cd frontend/packages
389- # pnpm test:coverage
389+ - name : 📦 Upload gate coverage artifact
390+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
391+ with :
392+ name : gate-coverage
393+ path : frontend/apps/gate/coverage/lcov.info
394+ if-no-files-found : error
395+
396+ test-frontend-console :
397+ name : 🧪 Console Tests (shard ${{ matrix.shard }}/4)
398+ needs : [detect-code-changes]
399+ if : ${{ always() && (github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'merge_group') && (needs.detect-code-changes.result == 'skipped' || needs.detect-code-changes.outputs.should-run == 'true') }}
400+ runs-on : ubuntu-latest
401+ timeout-minutes : 30
402+ strategy :
403+ fail-fast : false
404+ matrix :
405+ shard : [1, 2, 3, 4]
406+ steps :
407+ - name : 📥 Checkout Code
408+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
409+
410+ - name : ⚙️ Set up Node.js
411+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
412+ with :
413+ node-version : ${{ env.NODE_VERSION }}
414+
415+ - name : 📦 Install pnpm
416+ uses : pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
417+ with :
418+ run_install : false
419+ cache_dependency_path : pnpm-lock.yaml
420+
421+ - name : 📦 Install Frontend Dependencies
422+ run : |
423+ pnpm install --frozen-lockfile
424+
425+ - name : 🔨 Build Frontend
426+ run : |
427+ pnpm build:frontend
428+
429+ - name : 🧪 Run Console Tests with Coverage
430+ run : |
431+ cd frontend/apps/console
432+ pnpm vitest run --coverage --shard=${{ matrix.shard }}/4
390433
391434 # Strip branch data (BRDA/BRF/BRH) from frontend LCOV reports before uploading.
392435 # React Compiler (babel-plugin-react-compiler) generates phantom branch points in compiled
393436 # output that inflate the partial-line count in Codecov's coverage calculation.
394437 # This is a known upstream issue: https://github.com/facebook/react/issues/32950
395438 # Line and function coverage remain unaffected and accurately reflect test quality.
396- - name : 🧹 Strip branch data from frontend LCOV reports
439+ - name : 🧹 Strip branch data from console LCOV report
397440 run : |
398- for lcov_file in frontend/apps/console/coverage/lcov.info frontend/packages/coverage/lcov.info; do
399- if [ -f "$lcov_file" ]; then
400- sed -i '/^BRDA:/d;/^BRF:/d;/^BRH:/d' "$lcov_file"
401- fi
402- done
441+ if [ -f "frontend/apps/console/coverage/lcov.info" ]; then
442+ sed -i '/^BRDA:/d;/^BRF:/d;/^BRH:/d' "frontend/apps/console/coverage/lcov.info"
443+ fi
403444
404445 - name : 📦 Upload console coverage artifact
405446 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -408,18 +449,10 @@ jobs:
408449 path : frontend/apps/console/coverage/lcov.info
409450 if-no-files-found : error
410451
411- - name : 📦 Upload gate coverage artifact
412- if : matrix.shard == 1
413- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
414- with :
415- name : gate-coverage
416- path : frontend/apps/gate/coverage/lcov.info
417- if-no-files-found : error
418-
419452 upload-frontend-coverage :
420453 name : 📊 Upload Frontend Coverage
421- needs : test-frontend
422- if : always() && needs.test-frontend.result == 'success'
454+ needs : [ test-frontend-packages, test-frontend-console]
455+ if : always() && needs.test-frontend-packages.result == 'success' && needs.test-frontend-console .result == 'success'
423456 runs-on : ubuntu-latest
424457 timeout-minutes : 30
425458 permissions :
@@ -624,6 +657,12 @@ jobs:
624657 with :
625658 node-version : ' lts/*'
626659
660+ - name : 📦 Install pnpm
661+ uses : pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
662+ with :
663+ run_install : false
664+ cache_dependency_path : pnpm-lock.yaml
665+
627666 - name : 📥 Download Built Distribution
628667 uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
629668 with :
0 commit comments