Files
playwright-dotnet/.github/workflows/test_docker.yml
2026-08-20 08:35:17 -07:00

54 lines
2.2 KiB
YAML

name: Test Docker
on:
push:
paths:
- '.github/workflows/test_docker.yml'
- 'src/Common/Version.props'
- '**/*.csproj'
- '**/*Dockerfile.*'
branches:
- main
- release-*
pull_request:
paths:
- '.github/workflows/test_docker.yml'
- '**/*Dockerfile.*'
branches:
- main
- release-*
workflow_dispatch:
jobs:
build:
timeout-minutes: 90
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
flavor: [noble, resolute]
runs-on: [ubuntu-24.04, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Setup .NET Core
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
with:
dotnet-version: |
8.0.x
10.0.x
- name: Install prerequisites and download drivers
shell: bash
run: ./build.sh --download-driver
- name: Build Docker image
run: |
ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}"
bash utils/docker/build.sh --$ARCH ${{ matrix.flavor }} playwright-dotnet:localbuild-${{ matrix.flavor }}
- name: Cleanup
run: dotnet clean src/ || true
- name: Test
# The docker image no longer set DOTNET_ROLL_FORWARD=Major, so net8.0 test binaries cannot run.
# See https://github.com/dotnet/dotnet-docker/issues/7255 and https://github.com/dotnet/dotnet-docker/pull/7256.
run: |
CONTAINER_ID="$(docker run --rm -e CI --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -e CI -d -t playwright-dotnet:localbuild-${{ matrix.flavor }} /bin/bash)"
docker exec -e BROWSER=chromium "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net10.0 --logger:"console;verbosity=detailed"
docker exec -e BROWSER=firefox "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net10.0 --logger:"console;verbosity=detailed"
docker exec -e BROWSER=webkit "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net10.0 --logger:"console;verbosity=detailed"