Add PR check for average time to load top-above-nav #8
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: Time to load ad | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
test: | |
name: Time to load ad | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
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: Start Commercial server | |
run: pnpm serve & npx wait-on -v -i 1000 http://localhost:3031/graun.standalone.commercial.js | |
working-directory: ./commercial | |
- name: Test time to load ad | |
run: pnpm time-to-load-ad | |
working-directory: ./commercial |