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'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.35.0-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
@ -252,7 +252,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/python:v1.35.0-jammy
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
steps:
- uses: actions/checkout@v3
- name: Set up Python
@ -280,7 +280,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/java:v1.35.0-jammy
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
@ -305,7 +305,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
@ -334,7 +334,7 @@ jobs:
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.35.0-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
strategy:
fail-fast: false
matrix:
@ -686,7 +686,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.35.0-jammy
container: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
steps:
- task: NodeTool@0
@ -706,7 +706,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/python:v1.35.0-jammy
container: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
steps:
- task: UsePythonVersion@0
@ -728,7 +728,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/java:v1.35.0-jammy
container: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
steps:
- task: JavaToolInstaller@0
@ -749,7 +749,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy
container: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
steps:
- task: UseDotNet@2
@ -772,28 +772,28 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright:v1.35.0-jammy
- image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
```
```yml python
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright/python:v1.35.0-jammy
- image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
```
```yml java
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright/java:v1.35.0-jammy
- image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
```
```yml csharp
executors:
pw-jammy-development:
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.
@ -817,7 +817,7 @@ to run tests on Jenkins.
```groovy js
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright:v1.35.0-jammy' } }
agent { docker { image 'mcr.microsoft.com/playwright:v%%VERSION%%-jammy' } }
stages {
stage('e2e-tests') {
steps {
@ -831,7 +831,7 @@ pipeline {
```groovy python
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 {
stage('e2e-tests') {
steps {
@ -845,7 +845,7 @@ pipeline {
```groovy java
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 {
stage('e2e-tests') {
steps {
@ -859,7 +859,7 @@ pipeline {
```groovy csharp
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 {
stage('e2e-tests') {
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)).
```yml js
image: mcr.microsoft.com/playwright:v1.35.0-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
```
```yml python
image: mcr.microsoft.com/playwright/python:v1.35.0-jammy
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
```
```yml java
image: mcr.microsoft.com/playwright/java:v1.35.0-jammy
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
```
```yml csharp
image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
```
### GitLab CI
@ -901,7 +901,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.35.0-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
script:
...
```
@ -912,7 +912,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright/python:v1.35.0-jammy
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
script:
...
```
@ -923,7 +923,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright/java:v1.35.0-jammy
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
script:
...
```
@ -934,7 +934,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
script:
...
```
@ -950,7 +950,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.35.0-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
parallel: 7
script:
- npm ci
@ -965,7 +965,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.35.0-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
parallel:
matrix:
- 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
```bash js
docker pull mcr.microsoft.com/playwright:v1.35.0-jammy
docker pull mcr.microsoft.com/playwright:v%%VERSION%%-jammy
```
```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
docker pull mcr.microsoft.com/playwright/dotnet:v1.35.0-jammy
docker pull mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
```
```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
@ -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.
```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
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
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
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
@ -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.
```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
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
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
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:

View File

@ -57,7 +57,7 @@ public class App {
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.35.0</version>
<version>%%VERSION%%</version>
</dependency>
</dependencies>
<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:
```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
npx playwright test --update-snapshots
```

View File

@ -88,31 +88,6 @@ async function run() {
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
{
const devicesDescriptorsSourceFile = path.join(PROJECT_DIR, 'packages', 'playwright-core', 'src', 'server', 'deviceDescriptorsSource.json')