Skip to content

Commit 820ef0d

Browse files
committed
chore: build the driver and the generated files from a pinned microsoft/playwright commit
DRIVER_VERSION holds a microsoft/playwright commit. scripts/upstream.py clones microsoft/playwright into .upstream/ (gitignored) at that commit; the wheel build builds the driver from it, and scripts/update_api.sh generates the API, the protocol files and the test registry from it. Nothing is downloaded from npm. - CI, publish, the Docker test and the Azure Docker pipeline run the same steps: get Playwright, build, test. The Lint job also checks that the generated files are up to date. - CONTRIBUTING.md, ROLLING.md and the playwright-roll skill follow these steps. `python scripts/upstream.py changes` lists the upstream diff to port, with the Python file for each change.
1 parent a65b9fc commit 820ef0d

20 files changed

Lines changed: 726 additions & 504 deletions

File tree

‎.azure-pipelines/publish-docker.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extends:
8282
echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json
8383
sudo service docker start
8484
85-
# scripts/build_driver.py fetches playwright-core with `npm pack`, which
85+
# The wheel build builds the driver from .upstream/ with `npm ci`, which
8686
# picks up the registry and credentials from this .npmrc.
8787
- task: Bash@3
8888
displayName: "setup .npmrc"
@@ -102,6 +102,9 @@ extends:
102102
pip install -e . --disable-pip-version-check
103103
displayName: "Install dependencies"
104104
105+
- script: python scripts/upstream.py checkout
106+
displayName: "Get Playwright"
107+
105108
- task: AzureCLI@2
106109
displayName: "Login to ACR via OIDC"
107110
inputs:

‎.claude/skills/playwright-release/SKILL.md‎

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ description: Prepare a Playwright Python release. Checks open bugs, adds Python-
66
# Preparing a Playwright Python release
77

88
In this skill, `1.xx` is the release (for example `1.64`), and `v1.xx.0` is its tag.
9-
`$PW_SRC_DIR` is the roll checkout of `microsoft/playwright` (see the
10-
`playwright-roll` skill, step 2).
9+
`.upstream/` is the checkout of `microsoft/playwright` at the commit in
10+
`DRIVER_VERSION` (`python scripts/upstream.py checkout`). Only read from it: do not
11+
commit or switch branches there.
1112

1213
Remotes: find the remote for `microsoft/playwright-python` with `git remote -v`.
1314
The commands below call it `upstream`.
@@ -31,24 +32,35 @@ gh issue list --repo microsoft/playwright-python --state open \
3132
If any are open, list them for the user and ask whether to continue. Do not
3233
close or comment on issues.
3334

34-
Check that the driver is rolled. `DRIVER_VERSION` (`npm=`) must be the driver
35-
for the release: a `1.xx.y` build, or a `1.xx.0-beta-…` build from `release-1.xx`,
36-
as the user says, and `rev=` the commit that it is built from. If it is not, roll with the `playwright-roll` skill. This is often
37-
already done. The roll commit goes into the release commit PR (step 3). When the
38-
API roll for 1.xx is already on `main`, that PR only moves `DRIVER_VERSION`.
35+
Check that the driver is rolled. `DRIVER_VERSION` must be a commit of
36+
`release-1.xx`: the tag `v1.xx.y`, or the tip of the branch, as the user says. The
37+
driver reports the version of `playwright-core` at that commit, so it must be
38+
`1.xx.y`:
39+
40+
```sh
41+
python scripts/upstream.py checkout
42+
git -C .upstream fetch origin release-1.xx
43+
git -C .upstream merge-base --is-ancestor "$(cat DRIVER_VERSION)" FETCH_HEAD && echo "on release-1.xx"
44+
git -C .upstream show "$(cat DRIVER_VERSION)":packages/playwright-core/package.json | grep '"version"'
45+
```
46+
47+
If it is not, roll with the `playwright-roll` skill (`python scripts/upstream.py pin v1.xx.y`,
48+
or `pin release-1.xx`). This is often already done. The roll commit goes into the
49+
release commit PR (step 3). When the API roll for 1.xx is already on `main`, that PR
50+
only moves `DRIVER_VERSION`.
3951

4052
## 2. Release notes (microsoft/playwright)
4153

4254
The Python notes in `docs/src/release-notes-python.md` are written in
4355
`microsoft/playwright` together with the Node.js notes. The
4456
`playwright-release-notes` skill there
45-
(`$PW_SRC_DIR/.claude/skills/playwright-release-notes/SKILL.md`) covers that,
57+
(`.claude/skills/playwright-release-notes/SKILL.md` on `main`) covers that,
4658
including the Python code style. Check that the `## Version 1.xx` section is on the
4759
release branch:
4860

4961
```sh
50-
git -C "$PW_SRC_DIR" fetch origin release-1.xx
51-
git -C "$PW_SRC_DIR" show FETCH_HEAD:docs/src/release-notes-python.md | grep -n '^## Version 1.xx$'
62+
git -C .upstream fetch origin release-1.xx
63+
git -C .upstream show FETCH_HEAD:docs/src/release-notes-python.md | grep -n '^## Version 1.xx$'
5264
```
5365

5466
If it is missing, tell the user: it should have landed with the Node.js notes.
@@ -66,20 +78,22 @@ different exception type. Leave out minor bug fixes, internal changes, and anyth
6678
the notes already cover. If nothing is significant, go to step 3. Otherwise list
6779
the changes for the user and ask whether to add them to the notes.
6880

69-
To add them, write them in the roll checkout, on a branch from `origin/main`:
81+
To add them, write them in a worktree of `.upstream/` next to this repository, on a
82+
branch from `origin/main`. `.upstream/` itself stays at the pin.
7083

7184
```sh
72-
git -C "$PW_SRC_DIR" fetch origin main
73-
git -C "$PW_SRC_DIR" checkout -b release-notes-1.xx-python origin/main
85+
notes="$(dirname "$PWD")/playwright-release-notes-1.xx"
86+
git -C .upstream fetch origin main
87+
git -C .upstream worktree add -b release-notes-1.xx-python "$notes" origin/main
7488
```
7589

7690
Commit, push to the user's fork of `microsoft/playwright`, and open the PR. If
7791
the checkout has no remote for the fork, add one. `gh api user --jq .login`
7892
gives the user's login.
7993

8094
```sh
81-
git -C "$PW_SRC_DIR" commit -am "docs: release notes for v1.xx Python"
82-
git -C "$PW_SRC_DIR" push <fork-remote> release-notes-1.xx-python
95+
git -C "$notes" commit -am "docs: release notes for v1.xx Python"
96+
git -C "$notes" push <fork-remote> release-notes-1.xx-python
8397
gh pr create --repo microsoft/playwright --head <login>:release-notes-1.xx-python \
8498
--title "docs: release notes for v1.xx Python" \
8599
--body "- Update the \`Version 1.xx\` Python release notes with upstream and Python-specific changes"
@@ -88,20 +102,19 @@ gh pr create --repo microsoft/playwright --head <login>:release-notes-1.xx-pytho
88102
After the PR merges, it needs a cherry-pick to `release-1.xx` (the
89103
`playwright-cherry-pick` skill in `microsoft/playwright`).
90104

91-
Then put the roll checkout back on the release branch. `./scripts/update_api.sh`
92-
reads the docs from it. Run the checkout checks from step 2 of the
93-
`playwright-roll` skill.
105+
Then remove the worktree:
94106

95107
```sh
96-
git -C "$PW_SRC_DIR" checkout release-1.xx
108+
git -C .upstream worktree remove "$notes"
97109
```
98110

99111
## 3. Release commit (playwright-python)
100112

101113
Open a PR from the branch with the roll commit:
102114

103115
- Title: `chore: roll Playwright to v1.xx.y`, where `v1.xx.y` is the Python
104-
release version, even when `DRIVER_VERSION` is a beta build.
116+
release version, even when `DRIVER_VERSION` is the tip of `release-1.xx` and not
117+
a tag.
105118
- Description: the Python release notes, in GitHub markdown (see below).
106119
The user copies this description into the GitHub release, so for this PR it
107120
replaces the "keep PR descriptions short" rule in `AGENTS.md`.

0 commit comments

Comments
 (0)