Repository navigation
90 lines (90 loc) · 3.63 KB
/
Copy pathtest_docker.yml
File metadata and controls
90 lines (90 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Test Docker
on:
push:
paths:
- '.github/workflows/test_docker.yml'
- 'setup.py'
- '**/Dockerfile.*'
branches:
- main
- release-*
pull_request:
paths:
- '.github/workflows/test_docker.yml'
- 'setup.py'
- '**/Dockerfile.*'
branches:
- main
- release-*
jobs:
build:
timeout-minutes: 120
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
docker-image-variant:
- jammy
- noble
- resolute
arch:
- amd64
- arm64
include:
- arch: amd64
runs-on: playwright-x64-ubuntu24-64-core
- arch: arm64
runs-on: playwright-arm64-ubuntu24-64-core
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.10"
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -r requirements.txt
pip install -e .
- name: Get Playwright
run: python scripts/upstream.py checkout
- name: Set up Docker
run: |
if ! command -v docker >/dev/null 2>&1; then
curl -fsSL https://get.docker.com | sh
fi
sudo service docker stop
sudo mkdir -p /etc/docker /mnt/docker
echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json
sudo service docker start
# The docker group of a fresh install applies at the next login only.
sudo chmod 666 /var/run/docker.sock
# build.sh builds the wheels, and with them the driver.
- name: Build Docker image
run: bash utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.docker-image-variant }} playwright-python:localbuild-${{ matrix.docker-image-variant }}
- name: Start the container
id: container
run: |
docker run --rm -e CI -e PYTHONPATH=scripts -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-python:localbuild-${{ matrix.docker-image-variant }} /bin/bash
# Fix permissions for Git inside the container
docker exec playwright-docker-test chown -R root:root /root/playwright
docker exec playwright-docker-test pip install -r local-requirements.txt
docker exec playwright-docker-test pip install -r requirements.txt
docker exec playwright-docker-test pip install -e .
# The repo, with the driver that build.sh built into driver/, is bind-mounted
# into the container: this wheel build reuses that driver, and needs no
# Node.js in the image.
docker exec playwright-docker-test python -m build --wheel
# As in ci.yml: the dot reporter (scripts/pytest_dot_reporter.py, found through
# PYTHONPATH), and 16 workers.
- name: Test Sync API
run: docker exec playwright-docker-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/sync -n 16 -p pytest_dot_reporter -rfE --color=yes
- name: Test Async API
# Also after a failed sync step: the two suites report on their own.
if: ${{ !cancelled() && steps.container.outcome == 'success' }}
run: docker exec playwright-docker-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/async -n 16 -p pytest_dot_reporter -rfE --color=yes