Prepare code to remove GA from Web and AMP #952
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: E2E | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: 'playwright-${{ github.head_ref }}' | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Playwright | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
group: [1, 2, 3, 4, 5] | |
steps: | |
# Commercial | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: ./commercial | |
- run: corepack enable | |
working-directory: ./commercial | |
shell: bash | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './commercial/.nvmrc' | |
cache: 'pnpm' | |
cache-dependency-path: './commercial/pnpm-lock.yaml' | |
- name: Install dependencies | |
working-directory: ./commercial | |
run: pnpm install --frozen-lockfile | |
# We always run our commercial code against the latest main of DCR | |
# This does make our tests sensitive to changes in DCR | |
# (e.g. imagine someone removes the top-above-nav slot from DCR) | |
# This is something we accept in order to easily test our own code | |
# | |
# Note we use the containerised version of DCR, published from: | |
# https://github.com/guardian/dotcom-rendering/blob/6a6df272/.github/workflows/container.yml | |
# | |
# The argument `--network host` is crucial here, as it means the container shares the networking stack of the host | |
# This makes the commercial dev server available from inside the container | |
# Note that GHA provides a service container feature, but it does not support this argument | |
- name: Start DCR in a container | |
run: | | |
/usr/bin/docker run -d \ | |
--network host \ | |
-p 3030:3030 \ | |
-e "PORT=3030" \ | |
-e "COMMERCIAL_BUNDLE_URL=http://localhost:3031/graun.standalone.commercial.js" \ | |
ghcr.io/guardian/dotcom-rendering:main | |
- name: Install Playwright Browsers | |
run: pnpm playwright install --with-deps chromium | |
working-directory: ./commercial | |
- name: Start Commercial server | |
run: pnpm serve & npx wait-on -v -i 1000 http://localhost:3031/graun.standalone.commercial.js | |
working-directory: ./commercial | |
- name: Run Playwright | |
run: pnpm playwright test --grep-invert test-ad-load-time.spec.ts --shard=${{ matrix.group }}/5 | |
working-directory: ./commercial | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report-${{ matrix.group }} | |
path: ./commercial/playwright-report | |
retention-days: 5 |