Repository navigation
117 lines (104 loc) · 4.72 KB
/
Copy pathcoverage-report.yml
File metadata and controls
117 lines (104 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Coverage Report (Non-gating)
# Generates coverage reports with broad instrumentation (src/**/*.{ts,tsx})
# but does NOT gate on test pass/fail. Allows monitoring coverage expansion
# progress without blocking PRs on V8/vi.mock() incompatibilities (see #19998).
on:
push:
branches: [main]
paths:
- 'web/src/**'
- 'web/netlify/functions/**'
- 'web/package.json'
- 'web/package-lock.json'
- 'web/vite.config.ts'
pull_request:
paths:
- 'web/src/**'
- 'web/netlify/functions/**'
- 'web/package.json'
- 'web/package-lock.json'
- 'web/vite.config.ts'
workflow_dispatch:
concurrency:
group: coverage-report-${{ github.ref }}
cancel-in-progress: true
permissions: read-all # default read; writes scoped to job below
env:
NODE_VERSION: '22'
jobs:
coverage-report:
if: github.repository == 'kubestellar/console'
runs-on: ubuntu-latest
# #23490 — broad coverage instrumentation over all of src/**/*.{ts,tsx} is
# slower than the narrower "gate subset" run. 40 min was no longer enough
# headroom either (100/100 runs cancelled 2026-09-23..2026-10-07, each
# hitting the ceiling mid-suite before the non-gating summary was produced).
# If the suite keeps growing, shard this run like coverage-hourly.yml
# (TOTAL_SHARDS) instead of raising this further.
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install dependencies
working-directory: web
run: npm ci || npm ci
- name: Run tests with broad coverage instrumentation
id: coverage
working-directory: web
# Use continue-on-error so test failures from V8/vi.mock() incompatibility
# don't fail the workflow. This job is for coverage metrics only.
continue-on-error: true
env:
# Per-process heap cap; with --maxWorkers=2 total stays well under the
# ~7 GB runner RAM. Parallel forks at 6 GB each SIGABRT (#24314).
NODE_OPTIONS: '--max-old-space-size=4096'
run: |
# Override coverage.include via CLI to use broad src/**/*.{ts,tsx} pattern
# instead of the narrow include in vite.config.ts
npx vitest run --coverage \
--coverage.include='src/**/*.ts' \
--coverage.include='src/**/*.tsx' \
--reporter=default \
--maxWorkers=2
- name: Generate coverage summary
if: always()
working-directory: web
env:
COVERAGE_OUTCOME: ${{ steps.coverage.outcome }}
run: |
if [ -f coverage/coverage-summary.json ]; then
PCT=$(jq -r '.total.lines.pct // 0' coverage/coverage-summary.json)
STMTS=$(jq -r '.total.statements.pct // 0' coverage/coverage-summary.json)
BRANCHES=$(jq -r '.total.branches.pct // 0' coverage/coverage-summary.json)
FUNCS=$(jq -r '.total.functions.pct // 0' coverage/coverage-summary.json)
echo "## Coverage Report (Broad Instrumentation)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "ℹ️ This report uses \`src/**/*.{ts,tsx}\` instrumentation and does NOT gate on test failures." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Percentage |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-----------|" >> $GITHUB_STEP_SUMMARY
echo "| Lines | ${PCT}% |" >> $GITHUB_STEP_SUMMARY
echo "| Statements | ${STMTS}% |" >> $GITHUB_STEP_SUMMARY
echo "| Branches | ${BRANCHES}% |" >> $GITHUB_STEP_SUMMARY
echo "| Functions | ${FUNCS}% |" >> $GITHUB_STEP_SUMMARY
else
if [ "$COVERAGE_OUTCOME" = "failure" ] || [ "$COVERAGE_OUTCOME" = "cancelled" ]; then
echo "⚠️ Coverage run FAILED (step outcome: ${COVERAGE_OUTCOME}) — no summary generated. Check the test step logs for worker crashes (SIGABRT/OOM)." >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ No coverage summary generated (step outcome: ${COVERAGE_OUTCOME})" >> $GITHUB_STEP_SUMMARY
fi
fi
- name: Upload coverage HTML report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coverage-report-broad-${{ github.run_number }}
path: web/coverage/
if-no-files-found: ignore
retention-days: 7