Skip to content

Commit 8dc8e59

Browse files
committed
ci(pages): judge the demo boot with shinylive-check, before deploy and live after it
The build job now runs shinylive-check against the local-URL export before the app-specific behavior script, keeping a full-page screenshot as an artifact when the boot fails. A new post-deploy verify job probes the live Pages URL, the first check to see the public-URL rebuild that actually ships.
1 parent 81d5026 commit 8dc8e59

4 files changed

Lines changed: 69 additions & 7 deletions

File tree

.github/workflows/pages.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Pages
22

33
# Builds the shinylive demo from the current checkout and deploys it to GitHub Pages,
4-
# after proving in a real browser that it renders (make site-check). Every step is a
5-
# make target, so the same build and the same proof run locally.
4+
# after proving in a real browser that it renders (make site-check), then probes the
5+
# live site once deployed (make site-verify). Every step is a make target, so the
6+
# same build and the same proofs run locally.
67

78
on:
89
push:
@@ -41,6 +42,14 @@ jobs:
4142
- name: Build the site and prove it renders
4243
run: make site-check
4344

45+
- name: Keep the evidence when the boot check fails
46+
if: failure()
47+
uses: actions/upload-artifact@v7
48+
with:
49+
name: boot-failure
50+
path: tmp/boot-failure.png
51+
if-no-files-found: ignore
52+
4453
- name: Rebuild against the public URL
4554
run: make site SITE_URL=https://rvben.github.io/shiny-plotly
4655

@@ -59,3 +68,28 @@ jobs:
5968
steps:
6069
- id: deployment
6170
uses: actions/deploy-pages@v4
71+
72+
# The build job checks the local-URL export; what ships is the public-URL rebuild,
73+
# whose wheel URL only exists once deployed. Probe the live site so a deploy that
74+
# boots broken fails the workflow instead of sitting green.
75+
verify:
76+
needs: deploy
77+
runs-on: ubuntu-latest
78+
timeout-minutes: 15
79+
steps:
80+
- uses: actions/checkout@v7
81+
82+
- uses: astral-sh/setup-uv@v10.0.1
83+
with:
84+
version: "0.12.5"
85+
python-version: "3.12"
86+
enable-cache: true
87+
88+
- name: Sync
89+
run: make sync
90+
91+
- name: Install Chromium
92+
run: make browsers PLAYWRIGHT_ARGS=--with-deps
93+
94+
- name: Boot the live site in Chromium
95+
run: make site-verify

Makefile

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: sync lock-check browsers lint fmt typecheck test test-browser test-all build check-wheel \
22
check-floor bench bench-events check version check-version release-notes publish clean \
3-
site site-check release-patch release-minor release-major
3+
site site-check site-verify release-patch release-minor release-major
44

55
# Every CI step is one of these targets; the workflows only call make.
66

@@ -89,7 +89,8 @@ bench-events:
8989
# Pinned: the demo build runs only in the Pages workflow, so a shinylive release
9090
# could break the deploy with no CI run ever having seen it. Bump deliberately.
9191
SHINYLIVE_VERSION := 0.8.11
92-
SITE_URL ?= http://127.0.0.1:8008
92+
SITE_PORT := 8008
93+
SITE_URL ?= http://127.0.0.1:$(SITE_PORT)
9394

9495
# Exports the shinylive demo app with the wheel built from this checkout, so the
9596
# deployed demo tracks main, not PyPI. The committed examples/shinylive stays a
@@ -105,12 +106,24 @@ site: build
105106
mkdir -p site/wheels
106107
cp dist/*.whl site/wheels/
107108

108-
# Serves the exported site and proves the demo renders in Chromium: pyodide boots,
109-
# the wheel installs, the stream ticks, the Explore tab draws. The Pages workflow
110-
# runs this before rebuilding with the public URL and deploying.
109+
# Proves the export in two passes. shinylive-check judges the boot generically
110+
# (console and page errors, output errors, a screenshot artifact on failure; it must
111+
# serve on SITE_PORT because the export references its wheel by that absolute URL).
112+
# tools/site_check.py then proves the app-specific behavior a boot check cannot:
113+
# the stream ticks and the Explore tab draws. The Pages workflow runs this before
114+
# rebuilding with the public URL and deploying.
111115
site-check: site
116+
mkdir -p tmp
117+
uv run shinylive-check site --port $(SITE_PORT) --screenshot tmp/boot-failure.png
112118
uv run python tools/site_check.py --site site --url $(SITE_URL)
113119

120+
# Probes the deployed demo after the Pages deploy. The public-URL rebuild that
121+
# actually ships can only be proven live (its wheel URL does not exist before the
122+
# deploy), so this is the first check that sees what visitors get.
123+
PAGES_URL ?= https://rvben.github.io/shiny-plotly/
124+
site-verify:
125+
uv run shinylive-check $(PAGES_URL)
126+
114127
# The version in pyproject.toml, the single source for the package version.
115128
version:
116129
@sed -n 's/^version = "\(.*\)"$$/\1/p' pyproject.toml

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ dev = [
5858
"pytest-playwright>=0.9.0",
5959
"numpy>=1.26",
6060
"brotli>=1.1",
61+
"shinylive-check>=0.1.0",
6162
]
6263

6364
# uv's default cache keys for a local build are the metadata files only, so a source-only

uv.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)