Skip to content

GitHub Actions

GitHub Actions is the easiest way to run Webperf Core regularly against a public website. You don't need a server of your own.

Public websites only

GitHub Actions runs in Microsoft's cloud and can't reach your staging environment behind a firewall. For those sites, use a local install, Docker on your own server, or Webperf Cloud, which can test from static IP addresses you allowlist and comes with support if the setup gives you trouble.

The easy route: fork the repository

Webperf Core already contains a ready-made workflow. You don't have to write any YAML.

  1. Fork webperf_core
  2. Go to the Actions tab in your fork. You may need to enable workflows the first time.
  3. Pick Manual - Run test against url from the list on the left
  4. Click Run workflow and fill in:

    Field Meaning
    Webpage url to test The address to test
    Test to run Test numbers, comma separated
    Setting general.language en or sv
    Setting general.review.details true gives a fuller review
    Setting general.review.data true attaches the raw data as JSON
    Setting general.review.improve-only true shows only what can be improved
  5. Find the result under Actions → the run → Build → the section "Test … for …"

Keep your fork up to date

Press Sync fork on the repository's front page now and then. If you're not going to contribute code, you can disable every workflow except "Manual - Run test against url". Updates then go faster.

Your own workflow

If you want to run the tests in your own repository, for example on every deployment, run the public Docker image directly. There is no ready-made action on the GitHub Marketplace.

name: Webperf test

on:
  push:
    branches: [main]
  schedule:
    # every Monday at 06:00 UTC
    - cron: '0 6 * * 1'
  workflow_dispatch:

jobs:
  webperf:
    runs-on: ubuntu-latest
    steps:
      - name: Run Webperf Core
        run: |
          docker run --rm \
            --shm-size=4g \
            -e MAX_OLD_SPACE_SIZE=3000 \
            webperfse/webperf-core:latest \
            python default.py \
              -u https://example.com \
              -t 22,9,18 \
              -r \
              --setting general.language=en

Test several addresses

jobs:
  webperf:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        url:
          - https://example.com
          - https://example.com/contact/
          - https://example.com/about/
    steps:
      - name: Run Webperf Core
        run: |
          docker run --rm --shm-size=4g -e MAX_OLD_SPACE_SIZE=3000 \
            webperfse/webperf-core:latest \
            python default.py -u ${{ matrix.url }} -t 22 -r

Keep the report as an artifact

Write the result into a mounted folder and upload it:

      - name: Run Webperf Core
        run: |
          mkdir -p reports
          docker run --rm --shm-size=4g -e MAX_OLD_SPACE_SIZE=3000 \
            -v "$PWD/reports:/usr/src/runner/output" \
            webperfse/webperf-core:latest \
            python default.py -u https://example.com -t 22 -o output/report.json

      - name: Upload the report
        uses: actions/upload-artifact@v4
        with:
          name: webperf-report-${{ github.sha }}
          path: reports/report.json
          retention-days: 30

Fail the build on a low score

      - name: Check the minimum score
        run: |
          TOTAL=$(jq '.[0].rating' reports/report.json)
          if (( $(echo "$TOTAL < 3.0" | bc -l) )); then
            echo "Overall score $TOTAL is below 3.0"
            exit 1
          fi
          echo "Overall score $TOTAL passes"

Check the field names

The structure of the JSON output can change between versions. Run the test once and look at the file before you build a gate that blocks deployments.

Scheduling

on:
  schedule:
    - cron: '0 6 * * *'     # every day at 06:00 UTC
    - cron: '0 6 * * 1,4'   # Mondays and Thursdays
    - cron: '0 6 1 * *'     # the first day of each month

Troubleshooting

The tests take too long

A job may run for up to six hours, which is rarely the issue. If it's still too slow: run fewer tests per job, test fewer addresses, or split the work across several jobs running in parallel.

Lighthouse fails

Give Node more memory:

-e MAX_OLD_SPACE_SIZE=4096

and raise --shm-size accordingly.

The IPv6 checks are skipped

GitHub Actions has no IPv6. That's why the IPv6 checks in the email test are off by default. Run them locally instead:

python default.py -u https://example.com -t 24 \
  --setting tests.email.support.ipv6=true
The email test runs fewer checks than expected

Port 25 is blocked in GitHub Actions, so the checks that need a direct connection to the recipient's mail server are skipped. The rest of the test works.

Next steps