devops: Build driver from source #817
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| runs-on: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| 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: 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: Test | |
| run: | | |
| CONTAINER_ID="$(docker run --rm -e CI -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 "${CONTAINER_ID}" chown -R root:root /root/playwright | |
| docker exec "${CONTAINER_ID}" pip install -r local-requirements.txt | |
| docker exec "${CONTAINER_ID}" pip install -r requirements.txt | |
| docker exec "${CONTAINER_ID}" pip install -e . | |
| # build.sh (above) already built the driver bundles into driver/ on the | |
| # host. The repo is bind-mounted into the container, so this in-container | |
| # wheel build reuses those bundles (setup.py skips the source build when | |
| # the zip already exists) and therefore needs no Node.js in the image. | |
| docker exec "${CONTAINER_ID}" python -m build --wheel | |
| docker exec "${CONTAINER_ID}" xvfb-run pytest tests/sync/ | |
| docker exec "${CONTAINER_ID}" xvfb-run pytest tests/async/ |