mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fdf750522a
Folks on the internet claim 18.04 never runs out of disk space for them for github actions.
133 lines
4.7 KiB
YAML
133 lines
4.7 KiB
YAML
name: "Docker tests"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release-*
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/tests_docker.yml'
|
|
- '**/Dockerfile*'
|
|
- 'browsers.json'
|
|
- 'package.json'
|
|
branches:
|
|
- main
|
|
- release-*
|
|
|
|
env:
|
|
# Force terminal colors. @see https://www.npmjs.com/package/colors
|
|
FORCE_COLOR: 1
|
|
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
|
|
|
|
jobs:
|
|
test_linux_docker:
|
|
name: "Docker ${{ matrix.os_name}} ${{ matrix.arch}} ${{ matrix.user }} Tests"
|
|
runs-on: ubuntu-18.04
|
|
if: github.repository == 'microsoft/playwright'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os_name: "Ubuntu 18.04"
|
|
tag: bionic
|
|
user: pwuser
|
|
arch: amd64
|
|
- os_name: "Ubuntu 20.04"
|
|
tag: focal
|
|
user: root
|
|
arch: arm64
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 16
|
|
- name: Set up Docker QEMU for arm64 docker builds
|
|
if: ${{ matrix.arch == 'arm64' }}
|
|
uses: docker/setup-qemu-action@v1
|
|
with:
|
|
platforms: arm64
|
|
- run: npm i -g npm@8
|
|
- run: npm ci
|
|
- run: npm run build
|
|
- run: ./utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.tag }} playwright:localbuild
|
|
- name: Freeup Space
|
|
run: |
|
|
pwd
|
|
df -h
|
|
# Based on the official advice:
|
|
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf "/usr/local/share/boost"
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
df -h
|
|
|
|
- name: Launch container
|
|
run: |
|
|
docker run \
|
|
--rm \
|
|
--name docker-tests \
|
|
--platform linux/${{ matrix.arch }} \
|
|
--user=${{ matrix.user }} \
|
|
--workdir /home/pwuser \
|
|
--env CI \
|
|
--env INSIDE_DOCKER=1 \
|
|
-d \
|
|
-t \
|
|
playwright:localbuild /bin/bash
|
|
- name: Clone inside docker
|
|
run: |
|
|
docker exec docker-tests /bin/bash -c '
|
|
git clone https://github.com/microsoft/playwright
|
|
cd playwright
|
|
git checkout ${{ env.GITHUB_SHA }}
|
|
git show
|
|
'
|
|
- name: Run "npm ci" inside docker
|
|
run: docker exec --workdir /home/pwuser/playwright docker-tests npm ci
|
|
- name: Run "npm run build" inside docker
|
|
run: docker exec --workdir /home/pwuser/playwright docker-tests npm run build
|
|
# Test channel installation for root user.
|
|
# Note #1: as of Dec 2021, pwuser would require manual password for root since we don't ship passwordless sudo (and any sudo, actually) in our containers.
|
|
# Note #2: neither chrome nor msedge are shipped for arm64.
|
|
- name: Test installing Chrome & MSEdge
|
|
if: matrix.user == 'root' && matrix.arch == 'amd64'
|
|
run: docker exec --workdir /home/pwuser/playwright docker-tests docker-tests -test npx playwright install chrome msedge
|
|
- name: Run "npm run test" inside docker
|
|
run: docker exec --workdir /home/pwuser/playwright docker-tests xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm run test
|
|
- name: Upload Flakiness dashboard
|
|
if: always()
|
|
run: |
|
|
# Flakiness dashboard has to be uploaded from-inside docker container so that it can collect meta information, e.g. arch
|
|
# See https://github.com/microsoft/playwright/blob/13b1e52d95df416fdfa7846c8a840aad8df263af/utils/upload_flakiness_dashboard.sh#L71-L86
|
|
docker exec \
|
|
--env FLAKINESS_CONNECTION_STRING \
|
|
--env GITHUB_REPOSITORY \
|
|
--env GITHUB_REF \
|
|
--env GITHUB_RUN_ID \
|
|
--workdir /home/pwuser/playwright docker-tests /bin/bash -c '
|
|
if ! command -v pip3 >/dev/null; then
|
|
apt-get update
|
|
apt-get install python-pip3
|
|
fi
|
|
# Azure-CLI is needed for upload_flakiness_dashboard.sh script.
|
|
# Azure-CLI can only be installed via PIP3 inside ubuntu 20.04 arm64,
|
|
# see https://github.com/Azure/azure-cli/issues/7368
|
|
pip install azure-cli
|
|
./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
|
'
|
|
- name: Copy test results from container
|
|
if: always()
|
|
run: docker cp docker-tests:/home/pwuser/playwright/test-results ./test-results
|
|
- name: Upload Github Artifacts
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: docker-ubuntu-${{ matrix.tag }}-${{ matrix.arch }}-${{ matrix.user }}-test-results
|
|
path: test-results
|
|
- name: Stop container
|
|
if: always()
|
|
run: docker kill docker-tests
|
|
|