Repository navigation
158 lines (140 loc) · 5.37 KB
/
Copy pathdocs.yml
File metadata and controls
158 lines (140 loc) · 5.37 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Deploy GitHub Pages
# Builds the documentation site and the in-browser EaglePlot app (served at …/app/),
# smoke-tests the app in Chromium, and deploys both together (roadmap D3).
# Pull requests that touch the app or the site build and test it, but don't deploy.
on:
push:
branches: [main]
paths:
- "docs/**"
- "build_docs.py"
- "eagleplot/**"
- "packaging/web/**"
- "scripts/web/**"
- ".streamlit/**"
- "pyproject.toml"
- ".github/workflows/docs.yml"
pull_request:
paths:
- "docs/**"
- "build_docs.py"
- "eagleplot/**"
- "packaging/web/**"
- "scripts/web/**"
- ".streamlit/**"
- "pyproject.toml"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
# One deployment at a time (never cancelled); a newer push to the same PR cancels the
# older test run.
concurrency:
group: ${{ github.event_name == 'pull_request' && format('pages-pr-{0}', github.ref) || 'pages' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Build and test site
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.12
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install docs build dependencies
run: pip install markdown pytest
# build_docs.py renders each guide into a styled page and wires them together
# (audit A-13).
- name: Build documentation site
run: python build_docs.py
# The test matrix doesn't install markdown, so these tests skip there; this is
# where they run (broken links, raw .md links, nav on every page).
- name: Test the documentation build
run: python -m pytest tests/test_docs_site.py -q -p no:cacheprovider
# The app runs entirely in the browser (stlite: Streamlit on Pyodide). Pyodide comes
# from the jsDelivr CDN; everything else is in the site. See packaging/web/README.md.
- name: Build the web app into the site
run: |
python packaging/web/build_site.py docs/_site/app
cp packaging/web/pages-404.html docs/_site/404.html
du -sh docs/_site docs/_site/app
- uses: actions/setup-node@v7
with:
node-version: "22"
- name: Install Playwright + Chromium
run: |
npm install --no-save playwright@1
npx playwright install --with-deps chromium
# Every page, empty and with example data; an on-click download; and no request to
# any origin but the site and the Pyodide CDN.
- name: Smoke-test the web app
run: |
nohup python -m http.server -d docs/_site 8000 > http.log 2>&1 &
for i in $(seq 1 30); do curl -sf localhost:8000/app/ >/dev/null && break; sleep 1; done
node scripts/web/smoke.js http://127.0.0.1:8000/app/ --out build/web-smoke
# Start-up time with the real Pyodide CDN (roadmap D4): a fresh profile (first visit),
# then a reload with the cache kept. Reported in the summary; it doesn't gate.
- name: Measure start-up
continue-on-error: true
run: node scripts/web/boot_timing.js http://127.0.0.1:8000/app/ --runs 3 --out build/web-smoke/boot.json | tee build/web-smoke/boot.txt
- name: Summary
if: always()
run: |
{
echo "## Web app smoke test"
python - <<'PY'
import json, pathlib
p = pathlib.Path("build/web-smoke/smoke.json")
if not p.exists():
print("(no result)")
else:
s = json.loads(p.read_text())
print(f"Boot {s['bootMs'] / 1000:.1f} s, {s['pages']} pages, failures: {s['failures']}")
print()
print("| Phase | Page | Time | Problems |")
print("| --- | --- | --- | --- |")
for r in s["results"]:
t = "-" if r.get("ms") is None else f"{r['ms'] / 1000:.1f} s"
bad = len(r["exceptions"]) + len(r["pageErrors"])
print(f"| {r['phase']} | {r['label']} | {t} | {bad or ''} |")
print()
print("Requests by origin: " + ", ".join(f"{o} ({n})" for o, n in s["origins"].items()))
PY
echo
echo "## Start-up time (Pyodide from the CDN)"
echo '```'
cat build/web-smoke/boot.txt 2>/dev/null || echo "(not measured)"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v7
if: always()
with:
name: web-smoke
path: build/web-smoke/
- name: Configure Pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v6
- name: Upload Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v5
with:
path: ./docs/_site/
deploy:
name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5