Skip to content

Commit bac1640

Browse files
ci(frontend): publish generated dashboard diagnostics
1 parent 98f8956 commit bac1640

1 file changed

Lines changed: 51 additions & 85 deletions

File tree

.github/workflows/benchmark-frontend.yml

Lines changed: 51 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ name: Benchmark Frontend CI
22

33
on:
44
push:
5-
branches: [master, frontend-dashboard-data-pipeline]
5+
branches: [master]
66
paths:
77
- '.github/workflows/benchmark-frontend.yml'
88
- 'dev/benchmarks/**'
99
- 'dev/tests/test_benchmark_frontend_data.py'
1010
- 'dev/tests/test_frontend_contracts.py'
1111
- 'dev/tests/test_frontend_domain_coverage.py'
12+
- 'dev/tests/fixtures/benchmark_frontend/**'
1213
- 'frontend/**'
1314
- 'docs/assets/benchmarks/**'
1415
- 'results/benchmark_frontend_sources/**'
@@ -19,13 +20,13 @@ on:
1920
- 'dev/tests/test_benchmark_frontend_data.py'
2021
- 'dev/tests/test_frontend_contracts.py'
2122
- 'dev/tests/test_frontend_domain_coverage.py'
23+
- 'dev/tests/fixtures/benchmark_frontend/**'
2224
- 'frontend/**'
2325
- 'docs/assets/benchmarks/**'
2426
- 'results/benchmark_frontend_sources/**'
2527

2628
jobs:
2729
python-data:
28-
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
2930
runs-on: ubuntu-latest
3031
strategy:
3132
matrix:
@@ -35,16 +36,25 @@ jobs:
3536
- uses: actions/setup-python@v5
3637
with:
3738
python-version: ${{ matrix.python-version }}
38-
- run: python -m pip install -U pip pytest jsonschema
39-
- run: |
39+
- name: Install test dependencies
40+
run: python -m pip install -U pip pytest jsonschema
41+
- name: Run generator and parser tests
42+
run: |
43+
set -o pipefail
4044
pytest \
4145
dev/tests/test_benchmark_frontend_data.py \
4246
dev/tests/test_frontend_contracts.py \
43-
dev/tests/test_frontend_domain_coverage.py -v
44-
- run: python dev/benchmarks/generate_benchmark_data.py --check --strict-sources
47+
dev/tests/test_frontend_domain_coverage.py -vv 2>&1 | tee pytest-frontend.log
48+
- uses: actions/upload-artifact@v4
49+
if: always()
50+
with:
51+
name: pytest-frontend-${{ matrix.python-version }}
52+
path: pytest-frontend.log
53+
retention-days: 7
54+
- name: Validate generator output
55+
run: python dev/benchmarks/generate_benchmark_data.py --check --strict-sources
4556

4657
frontend:
47-
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
4858
runs-on: ubuntu-latest
4959
defaults:
5060
run:
@@ -54,12 +64,20 @@ jobs:
5464
- uses: actions/setup-node@v4
5565
with:
5666
node-version: '20'
67+
- name: Reject committed frontend artifacts
68+
run: |
69+
if git -C "$GITHUB_WORKSPACE" ls-files \
70+
'frontend/node_modules/**' \
71+
'frontend/test-results/**' \
72+
'frontend/playwright-report/**' | grep -q .; then
73+
echo "Generated frontend dependencies/test artifacts must not be committed."
74+
exit 1
75+
fi
5776
- run: npm ci
5877
- run: npm run typecheck
5978
- run: npm run build
6079

6180
staleness:
62-
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
6381
runs-on: ubuntu-latest
6482
steps:
6583
- uses: actions/checkout@v4
@@ -69,22 +87,37 @@ jobs:
6987
- uses: actions/setup-node@v4
7088
with:
7189
node-version: '20'
72-
- run: |
90+
- name: Generate data (deterministic)
91+
run: |
7392
python dev/benchmarks/generate_benchmark_data.py \
7493
--out frontend/public/data/benchmark_data.json \
7594
--report frontend/public/data/parse_report.json \
7695
--inventory-out frontend/public/data/source_inventory.json \
7796
--deterministic --strict-sources
78-
- run: |
97+
- name: Build frontend
98+
run: |
7999
cd frontend
80100
npm ci
81101
npm run build
82-
- run: |
102+
- uses: actions/upload-artifact@v4
103+
with:
104+
name: june-dashboard-generated
105+
path: |
106+
frontend/public/data/
107+
docs/assets/benchmarks/
108+
retention-days: 7
109+
- name: Check staleness
110+
run: |
83111
changes="$(git status --porcelain -- frontend/public/data docs/assets/benchmarks)"
84-
test -z "$changes" || { printf '%s\n' "$changes"; exit 1; }
112+
if [ -n "$changes" ]; then
113+
echo "Generated benchmark assets are stale:"
114+
printf '%s\n' "$changes"
115+
git diff -- frontend/public/data docs/assets/benchmarks
116+
exit 1
117+
fi
118+
echo "OK — generated benchmark assets are current"
85119
86120
frontend-e2e:
87-
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
88121
runs-on: ubuntu-latest
89122
needs: [frontend, staleness]
90123
defaults:
@@ -98,76 +131,9 @@ jobs:
98131
- run: npm ci
99132
- run: npx playwright install --with-deps chromium
100133
- run: npm run test:e2e
101-
102-
refresh-june-dashboard:
103-
if: github.event_name == 'push' && github.ref == 'refs/heads/frontend-dashboard-data-pipeline'
104-
runs-on: ubuntu-latest
105-
permissions:
106-
contents: write
107-
steps:
108-
- uses: actions/checkout@v4
109-
with:
110-
ref: frontend-dashboard-data-pipeline
111-
- uses: actions/setup-python@v5
134+
- uses: actions/upload-artifact@v4
135+
if: always()
112136
with:
113-
python-version: '3.11'
114-
- uses: actions/setup-node@v4
115-
with:
116-
node-version: '20'
117-
- name: Run tests with diagnostic capture
118-
id: pytest
119-
continue-on-error: true
120-
run: |
121-
python -m pip install -U pip pytest jsonschema
122-
set -o pipefail
123-
pytest \
124-
dev/tests/test_benchmark_frontend_data.py \
125-
dev/tests/test_frontend_contracts.py \
126-
dev/tests/test_frontend_domain_coverage.py -vv 2>&1 | tee /tmp/june-dashboard-pytest.log
127-
- name: Commit failure summary
128-
if: steps.pytest.outcome == 'failure'
129-
run: |
130-
tail -n 200 /tmp/june-dashboard-pytest.log > dev/tests/june_dashboard_pytest_failure.txt
131-
rm -f .github/workflows/finalize-june-dashboard.yml
132-
git show b63e184fa2d9de3c1d2ba8f83c251c5788ca0847:.github/workflows/benchmark-frontend.yml > .github/workflows/benchmark-frontend.yml
133-
git config user.name github-actions[bot]
134-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
135-
git add -A
136-
git commit -m "test(frontend): capture June-only failure"
137-
git push origin HEAD:frontend-dashboard-data-pipeline
138-
- name: Generate bundle
139-
if: steps.pytest.outcome == 'success'
140-
run: |
141-
python dev/benchmarks/generate_benchmark_data.py \
142-
--out frontend/public/data/benchmark_data.json \
143-
--report frontend/public/data/parse_report.json \
144-
--inventory-out frontend/public/data/source_inventory.json \
145-
--deterministic --strict-sources
146-
- name: Build and test frontend
147-
if: steps.pytest.outcome == 'success'
148-
working-directory: frontend
149-
run: |
150-
npm ci
151-
npm run typecheck
152-
npm run build
153-
npx playwright install --with-deps chromium
154-
npm run test:e2e
155-
- name: Commit generated assets
156-
if: steps.pytest.outcome == 'success'
157-
run: |
158-
rm -f .github/workflows/finalize-june-dashboard.yml
159-
git show b63e184fa2d9de3c1d2ba8f83c251c5788ca0847:.github/workflows/benchmark-frontend.yml > .github/workflows/benchmark-frontend.yml
160-
read runs models <<EOF
161-
$(python - <<'PY'
162-
import json
163-
from pathlib import Path
164-
data = json.loads(Path('frontend/public/data/benchmark_data.json').read_text())
165-
print(len(data['runs']), len(data['models']))
166-
PY
167-
)
168-
EOF
169-
git config user.name github-actions[bot]
170-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
171-
git add -A
172-
git commit -m "build(frontend): publish June-only bundle (${runs} runs, ${models} models)"
173-
git push origin HEAD:frontend-dashboard-data-pipeline
137+
name: playwright-report
138+
path: frontend/playwright-report/
139+
retention-days: 30

0 commit comments

Comments
 (0)