🦋 Release package updates #2167
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 | |
id: start-dcr-container | |
continue-on-error: true | |
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 | |
echo "exitcode=$?" >> $GITHUB_OUTPUT | |
- name: Start DCR in a container step failed | |
if: ${{ failure() && steps.start-dcr-container.conclusion == 'failure' && steps.start-dcr-container.outputs.exitcode == 125 }} | |
run: echo "Unable to fetch a DCR container image from the registry. Run the DCR main build in order to create a new container image." && exit 1 | |
- 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 --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 |