chore: generate docs versions in pw.dev (#23412)

https://github.com/microsoft/playwright/issues/23395
This commit is contained in:
Max Schmitt 2023-06-01 01:14:00 +02:00 committed by GitHub
parent 90aa378e8f
commit 10ec3cfa2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 66 deletions

View file

@ -228,7 +228,7 @@ jobs:
name: 'Playwright Tests' name: 'Playwright Tests'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: mcr.microsoft.com/playwright:v1.35.0-jammy image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
@ -252,7 +252,7 @@ jobs:
name: 'Playwright Tests' name: 'Playwright Tests'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: mcr.microsoft.com/playwright/python:v1.35.0-jammy image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
@ -280,7 +280,7 @@ jobs:
name: 'Playwright Tests' name: 'Playwright Tests'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: mcr.microsoft.com/playwright/java:v1.35.0-jammy image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-java@v3 - uses: actions/setup-java@v3
@ -305,7 +305,7 @@ jobs:
name: 'Playwright Tests' name: 'Playwright Tests'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup dotnet - name: Setup dotnet
@ -334,7 +334,7 @@ jobs:
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}' name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: mcr.microsoft.com/playwright:v1.35.0-jammy image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -686,7 +686,7 @@ trigger:
pool: pool:
vmImage: ubuntu-latest vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.35.0-jammy container: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
steps: steps:
- task: NodeTool@0 - task: NodeTool@0
@ -706,7 +706,7 @@ trigger:
pool: pool:
vmImage: ubuntu-latest vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/python:v1.35.0-jammy container: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
steps: steps:
- task: UsePythonVersion@0 - task: UsePythonVersion@0
@ -728,7 +728,7 @@ trigger:
pool: pool:
vmImage: ubuntu-latest vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/java:v1.35.0-jammy container: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
steps: steps:
- task: JavaToolInstaller@0 - task: JavaToolInstaller@0
@ -749,7 +749,7 @@ trigger:
pool: pool:
vmImage: ubuntu-latest vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy container: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
steps: steps:
- task: UseDotNet@2 - task: UseDotNet@2
@ -772,28 +772,28 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
executors: executors:
pw-jammy-development: pw-jammy-development:
docker: docker:
- image: mcr.microsoft.com/playwright:v1.35.0-jammy - image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
``` ```
```yml python ```yml python
executors: executors:
pw-jammy-development: pw-jammy-development:
docker: docker:
- image: mcr.microsoft.com/playwright/python:v1.35.0-jammy - image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
``` ```
```yml java ```yml java
executors: executors:
pw-jammy-development: pw-jammy-development:
docker: docker:
- image: mcr.microsoft.com/playwright/java:v1.35.0-jammy - image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
``` ```
```yml csharp ```yml csharp
executors: executors:
pw-jammy-development: pw-jammy-development:
docker: docker:
- image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy - image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
``` ```
Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures.
@ -817,7 +817,7 @@ to run tests on Jenkins.
```groovy js ```groovy js
pipeline { pipeline {
agent { docker { image 'mcr.microsoft.com/playwright:v1.35.0-jammy' } } agent { docker { image 'mcr.microsoft.com/playwright:v%%VERSION%%-jammy' } }
stages { stages {
stage('e2e-tests') { stage('e2e-tests') {
steps { steps {
@ -831,7 +831,7 @@ pipeline {
```groovy python ```groovy python
pipeline { pipeline {
agent { docker { image 'mcr.microsoft.com/playwright/python:v1.35.0-jammy' } } agent { docker { image 'mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy' } }
stages { stages {
stage('e2e-tests') { stage('e2e-tests') {
steps { steps {
@ -845,7 +845,7 @@ pipeline {
```groovy java ```groovy java
pipeline { pipeline {
agent { docker { image 'mcr.microsoft.com/playwright/java:v1.35.0-jammy' } } agent { docker { image 'mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy' } }
stages { stages {
stage('e2e-tests') { stage('e2e-tests') {
steps { steps {
@ -859,7 +859,7 @@ pipeline {
```groovy csharp ```groovy csharp
pipeline { pipeline {
agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy' } } agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy' } }
stages { stages {
stage('e2e-tests') { stage('e2e-tests') {
steps { steps {
@ -876,19 +876,19 @@ pipeline {
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.md)). Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.md)).
```yml js ```yml js
image: mcr.microsoft.com/playwright:v1.35.0-jammy image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
``` ```
```yml python ```yml python
image: mcr.microsoft.com/playwright/python:v1.35.0-jammy image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
``` ```
```yml java ```yml java
image: mcr.microsoft.com/playwright/java:v1.35.0-jammy image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
``` ```
```yml csharp ```yml csharp
image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
``` ```
### GitLab CI ### GitLab CI
@ -901,7 +901,7 @@ stages:
tests: tests:
stage: test stage: test
image: mcr.microsoft.com/playwright:v1.35.0-jammy image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
script: script:
... ...
``` ```
@ -912,7 +912,7 @@ stages:
tests: tests:
stage: test stage: test
image: mcr.microsoft.com/playwright/python:v1.35.0-jammy image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
script: script:
... ...
``` ```
@ -923,7 +923,7 @@ stages:
tests: tests:
stage: test stage: test
image: mcr.microsoft.com/playwright/java:v1.35.0-jammy image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
script: script:
... ...
``` ```
@ -934,7 +934,7 @@ stages:
tests: tests:
stage: test stage: test
image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
script: script:
... ...
``` ```
@ -950,7 +950,7 @@ stages:
tests: tests:
stage: test stage: test
image: mcr.microsoft.com/playwright:v1.35.0-jammy image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
parallel: 7 parallel: 7
script: script:
- npm ci - npm ci
@ -965,7 +965,7 @@ stages:
tests: tests:
stage: test stage: test
image: mcr.microsoft.com/playwright:v1.35.0-jammy image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
parallel: parallel:
matrix: matrix:
- PROJECT: ['chromium', 'webkit'] - PROJECT: ['chromium', 'webkit']

View file

@ -18,19 +18,19 @@ This Docker image is intended to be used for testing and development purposes on
### Pull the image ### Pull the image
```bash js ```bash js
docker pull mcr.microsoft.com/playwright:v1.35.0-jammy docker pull mcr.microsoft.com/playwright:v%%VERSION%%-jammy
``` ```
```bash python ```bash python
docker pull mcr.microsoft.com/playwright/python:v1.35.0-jammy docker pull mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
``` ```
```bash csharp ```bash csharp
docker pull mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy docker pull mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
``` ```
```bash java ```bash java
docker pull mcr.microsoft.com/playwright/java:v1.35.0-jammy docker pull mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
``` ```
### Run the image ### Run the image
@ -42,19 +42,19 @@ By default, the Docker image will use the `root` user to run the browsers. This
On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers.
```bash js ```bash js
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v%%VERSION%%-jammy /bin/bash
``` ```
```bash python ```bash python
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy /bin/bash
``` ```
```bash csharp ```bash csharp
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy /bin/bash
``` ```
```bash java ```bash java
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy /bin/bash
``` ```
#### Crawling and scraping #### Crawling and scraping
@ -62,19 +62,19 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v1.35.0-jammy /
On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it.
```bash js ```bash js
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v%%VERSION%%-jammy /bin/bash
``` ```
```bash python ```bash python
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy /bin/bash
``` ```
```bash csharp ```bash csharp
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy /bin/bash
``` ```
```bash java ```bash java
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v1.35.0-jammy /bin/bash docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy /bin/bash
``` ```
[`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions:

View file

@ -57,7 +57,7 @@ public class App {
<dependency> <dependency>
<groupId>com.microsoft.playwright</groupId> <groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId> <artifactId>playwright</artifactId>
<version>1.35.0</version> <version>%%VERSION%%</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View file

@ -42,7 +42,7 @@ The snapshot name `example-test-1-chromium-darwin.png` consists of a few parts:
If you are not on the same operating system as your CI system, you can use Docker to generate/update the screenshots: If you are not on the same operating system as your CI system, you can use Docker to generate/update the screenshots:
```bash ```bash
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.35.0-jammy /bin/bash docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v%%VERSION%%-jammy /bin/bash
npm install npm install
npx playwright test --update-snapshots npx playwright test --update-snapshots
``` ```

View file

@ -88,31 +88,6 @@ async function run() {
writeAssumeNoop(browsersJSONPath, JSON.stringify(browsersJSON, null, 2) + '\n', dirtyFiles); writeAssumeNoop(browsersJSONPath, JSON.stringify(browsersJSON, null, 2) + '\n', dirtyFiles);
} }
// Patch docker version in docs
{
for (const filePath of getAllMarkdownFiles(path.join(PROJECT_DIR, 'docs'))) {
// Do not patch docker versions in the release notes; these are always handcrafted.
if (filePath.includes('release-notes-'))
continue;
let content = fs.readFileSync(filePath).toString();
content = content.replace(new RegExp('(mcr.microsoft.com/playwright[^:]*):([\\w\\d-.]+)', 'ig'), (match, imageName, imageVersion) => {
const [version, distroName] = imageVersion.split('-');
return `${imageName}:v${playwrightVersion}-${distroName ?? 'focal'}`;
});
writeAssumeNoop(filePath, content, dirtyFiles);
}
// Patch pom.xml
{
const introPath = path.join(PROJECT_DIR, 'docs', 'src', 'intro-java.md');
const pomVersionRe = new RegExp('^(\\s*<artifactId>playwright<\\/artifactId>\\n\\s*<version>)(.*)(<\\/version>)$', 'gm');
let content = fs.readFileSync(introPath).toString();
const majorVersion = playwrightVersion.replace(new RegExp('((\\d+\\.){2})(\\d+)'), '$10')
content = content.replace(pomVersionRe, '$1' + majorVersion + '$3');
writeAssumeNoop(introPath, content, dirtyFiles);
}
}
// Update device descriptors // Update device descriptors
{ {
const devicesDescriptorsSourceFile = path.join(PROJECT_DIR, 'packages', 'playwright-core', 'src', 'server', 'deviceDescriptorsSource.json') const devicesDescriptorsSourceFile = path.join(PROJECT_DIR, 'packages', 'playwright-core', 'src', 'server', 'deviceDescriptorsSource.json')