devops: Set up CI/CD with Azure Pipelines #427
Workflow file for this run
This file contains 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: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
docker-image-variant: | |
- focal | |
- jammy | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r local-requirements.txt | |
pip install -e . | |
- name: Build Docker image | |
run: bash utils/docker/build.sh --amd64 ${{ matrix.docker-image-variant }} playwright-python:localbuild-${{ matrix.docker-image-variant }} | |
- name: Test | |
run: | | |
CONTAINER_ID="$(docker run --rm -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 -e . | |
docker exec "${CONTAINER_ID}" python setup.py bdist_wheel | |
docker exec "${CONTAINER_ID}" xvfb-run pytest -vv tests/sync/ | |
docker exec "${CONTAINER_ID}" xvfb-run pytest -vv tests/async/ |