Skip to content

chore: build the driver and the generated files from a pinned microsoft/playwright commit #847

chore: build the driver and the generated files from a pinned microsoft/playwright commit

chore: build the driver and the generated files from a pinned microsoft/playwright commit #847

Workflow file for this run

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
runs-on:
- ubuntu-24.04
- ubuntu-24.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.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
# build.sh builds the wheels, and with them the driver.
- name: Build Docker image
run: |
ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}"
bash utils/docker/build.sh --$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 two workers, upstream's default of half the cores of these runners.
- name: Test Sync API
run: docker exec playwright-docker-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/sync -n 2 -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 2 -p pytest_dot_reporter -rfE --color=yes