From 34d151a1f9c438b045aa66c16bbc6fa31f9c338b Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 15 Jun 2021 23:59:20 -0700 Subject: [PATCH] devops: introduce Docker tests (#7157) Fixes #7139 --- .github/workflows/tests_secondary.yml | 39 +++++++++++++++++++++++++++ tests/config/default.config.ts | 1 + 2 files changed, 40 insertions(+) diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml index 88f7826a4b..c3a56dd65c 100644 --- a/.github/workflows/tests_secondary.yml +++ b/.github/workflows/tests_secondary.yml @@ -477,3 +477,42 @@ jobs: name: electron-linux-test-results path: test-results + + test_linux_docker: + name: "Docker Ubuntu-${{ matrix.tag }} Tests" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + tag: [bionic, focal] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + - run: npm ci + - run: npm run build + - name: Build + run: bash utils/docker/build.sh ${{ matrix.tag }} playwright:localbuild-${{ matrix.tag }} + - name: Clean & Prepare for Docker + run: | + npm run clean + rm -rf node_modules/ + # The whole folder has to be world-writable to avoid UID conflicts between this mount and docker. + chmod -R 777 . + - name: Launch container + run: docker run --rm -v $(pwd):/tmp/playwright --name playwright-docker-${{matrix.tag}}-test -d -t playwright:localbuild-${{ matrix.tag }} /bin/bash + - name: Run "npm ci" inside docker + run: docker exec --workdir /tmp/playwright/ --user=pwuser playwright-docker-${{matrix.tag}}-test npm ci + - name: Run "npm run build" inside docker + run: docker exec --workdir /tmp/playwright/ --user=pwuser playwright-docker-${{matrix.tag}}-test npm run build + - name: Run "npm run test" inside docker + run: docker exec --workdir /tmp/playwright/ --user=pwuser -e INSIDE_DOCKER=1 -e CI=1 playwright-docker-${{matrix.tag}}-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm run test + - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json + if: always() + - uses: actions/upload-artifact@v1 + if: ${{ always() }} + with: + name: docker-ubuntu-${{ matrix.tag }}-test-results + path: test-results + diff --git a/tests/config/default.config.ts b/tests/config/default.config.ts index 4f5650f28d..c1c6a18009 100644 --- a/tests/config/default.config.ts +++ b/tests/config/default.config.ts @@ -84,6 +84,7 @@ for (const browserName of browserNames) { define: { test: pageTest, fixtures: pageFixtures }, metadata: { platform: process.platform, + docker: !!process.env.INSIDE_DOCKER, headful: !!headed, browserName, channel,