Skip to content

Commit fc77e22

Browse files
committed
Enhance Playwright integration: add --no-sandbox and --disable-setuid-sandbox arguments for Linux CI compatibility
1 parent 5fb2cf7 commit fc77e22

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/docs.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,16 @@ jobs:
3939

4040
# ── Dependencies ───────────────────────────────────────────────────────
4141
# Install the package itself plus the [docs] optional-dependency group
42-
# (sphinx, pydata-sphinx-theme, sphinx-gallery, pillow).
43-
# sphinx-gallery transitively brings in matplotlib, which the custom
44-
# scraper (docs/_sg_html_scraper.py) needs to render thumbnails.
42+
# (sphinx, pydata-sphinx-theme, sphinx-gallery, pillow, playwright).
4543
- name: Install dependencies (with docs extras)
4644
run: uv sync --extra docs
4745

46+
# Playwright ships the Python bindings but NOT the browser binaries.
47+
# --with-deps also installs the OS-level shared libraries Chromium needs
48+
# (libglib2, libnss3, etc.) on bare Ubuntu runners.
49+
- name: Install Playwright browser
50+
run: uv run playwright install chromium --with-deps
51+
4852
# ── Determine deployment target ─────────────────────────────────────────
4953
# Release tag (refs/tags/v1.2.3) → destination = "v1.2.3"
5054
# Everything else (push to main, manual dispatch) → destination = "dev"

docs/_sg_html_scraper.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ def _make_thumbnail_png(widget) -> bytes:
7979

8080
try:
8181
with sync_playwright() as pw:
82-
browser = pw.chromium.launch(headless=True)
82+
# --no-sandbox is required on Linux CI runners (GitHub Actions,
83+
# etc.) where the kernel user-namespace sandbox is not available.
84+
browser = pw.chromium.launch(
85+
headless=True, args=["--no-sandbox", "--disable-setuid-sandbox"]
86+
)
8387
try:
8488
page = browser.new_page()
8589
# Set OS-level dark preference so every media query agrees.

0 commit comments

Comments
 (0)