devops: Build driver from source#3092
Open
Skn0tt wants to merge 2 commits into
Open
Conversation
154bd49 to
6e606d2
Compare
6e606d2 to
489119a
Compare
Stop downloading the prebuilt Playwright driver bundle from cdn.playwright.dev. Instead, clone microsoft/playwright at the tag matching driver_version and build the per-platform bundles from source via upstream's utils/build/build-playwright-driver.sh. - scripts/build_driver.sh: portable bash script (shareable across the language forks) that clones, builds (npm ci && npm run build), runs the upstream driver build, and stages all 6 platform zips into driver/. - setup.py: ensure_driver_bundle() shells out to the script when a bundle is missing; stale extract-dir cleanup before extraction. - CI/release: add Node 24 (matching the bundled runtime major) wherever wheels are built — ci.yml, publish_docker.yml, test_docker.yml host, Azure NodeTool; meta.yaml conda host gains git + nodejs. - Docs: ROLLING.md, CONTRIBUTING.md, CLAUDE.md, playwright-roll SKILL.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The per-job source build can't run on Windows (Git Bash lacks zip/unzip and the heavy upstream monorepo build is not exercised there), and rebuilding the fully cross-platform driver in every wheel job is redundant and slow. Add a single 'build-driver' job that builds all six platform bundles on Linux and uploads them as a workflow artifact. Every wheel-building job (Lint, Build, Stable, Conda) now downloads that artifact into driver/ so setup.py's ensure_driver_bundle early-returns and embeds the prebuilt zip -- no Node, bash or zip/unzip needed on Windows/macOS. A verify step asserts all six bundles are present before building. Docker and Azure publish are unchanged: they run on Linux and build the driver once on their own host, which already works. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
489119a to
d5585a5
Compare
dgozman
approved these changes
Jun 8, 2026
| } | ||
|
|
||
| clone_source() { | ||
| # Reuse an existing checkout only if it already points at exactly the pinned |
Contributor
There was a problem hiding this comment.
Not really sure why wipe the repo, instead of fetch/checkout the desired commit?
| echo "Installing Playwright dependencies (npm ci)" | ||
| (cd "$SOURCE_DIR" && npm ci) | ||
| echo "Building Playwright (npm run build)" | ||
| (cd "$SOURCE_DIR" && npm run build) |
Contributor
There was a problem hiding this comment.
I'd recommend npm run clean as well for a reused checkout.
| # Don't replace this with urllib - Python won't have certificates to do SSL on all platforms. | ||
| subprocess.check_call(["curl", url, "-o", temp_destination_path]) | ||
| os.rename(temp_destination_path, destination_path) | ||
| # Build all platform bundles from source (microsoft/playwright @ the commit |
Contributor
There was a problem hiding this comment.
It seems like I saw this comment ~15 times in this PR 😄
| without_platform = base_wheel_location[:-7] | ||
| download_driver(wheel_bundle["zip_name"]) | ||
| zip_file = f"driver/playwright-{driver_version}-{wheel_bundle['zip_name']}.zip" | ||
| ensure_driver_bundle(wheel_bundle["zip_name"]) |
Contributor
There was a problem hiding this comment.
Are we going to add all drivers for all platforms into the single wheel now, since we build all of them at once? Add a filter somewhere?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build the Playwright driver from source instead of downloading it from the CDN
setup.pyno longer downloads the prebuilt driver bundles fromcdn.playwright.dev. Instead it clonesmicrosoft/playwrightat tagv{driver_version}and builds the six platform bundles from source via theupstream
utils/build/build-playwright-driver.sh, then embeds them into theplatform wheels exactly as before. Same released version, same artifacts — just
self-built, so the wheels no longer depend on the CDN being reachable.
What changed
setup.py:download_driver()→ensure_driver_bundle(), which shellsout to a new portable
scripts/build_driver.sh <version>(and early-returns ifthe target bundle already exists).
scripts/build_driver.sh(new): portable bash builder that clones thepinned tag and produces all six bundles on a single host. Written in bash so it
can be shared with the other language ports.
.github/workflows/ci.yml: a singlebuild-driverjob builds the bundlesonce on Linux and shares them via the
driver-bundlesartifact; theinfra,build, andtest-stablejobs download + verify the bundles instead of eachrebuilding the toolchain. Cross-platform builds all happen on Linux (upstream's
script fetches a per-target Node), so Windows/macOS only need the prebuilt zips.
.github/workflows/{publish_docker,test_docker}.yml,.azure-pipelines/publish.yml: provision Node so the wheel build can compilethe driver.
CONTRIBUTING.md,ROLLING.md,CLAUDE.md,.claude/skills/playwright-roll/SKILL.md): document the build-from-source flow.Notes
main(driver1.60.0); contains no conda changes(rebased after chore: drop Conda distribution #3091 dropped the conda distribution).