Skip to content
Latchkey

Nightly Wagtail test workflow (torchbox/wagtailmedia)

The Nightly Wagtail test workflow from torchbox/wagtailmedia, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: torchbox/wagtailmedia.github/workflows/nightly-tests.ymlLicense BSD-3-ClauseView source

What it does

This is the Nightly Wagtail test workflow from the torchbox/wagtailmedia repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Nightly Wagtail test

on:
  schedule:
    - cron: "0 0 * * 1"

  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:  {}

jobs:
  nightly-test:
    name: Nightly tests against Wagtail main
    # Cannot check the existence of secrets, so limiting to repository name to prevent all forks to run nightly.
    # See: https://github.com/actions/runner/issues/520
    if: ${{ github.repository == 'torchbox/wagtailmedia' }}
    runs-on: ubuntu-latest
    permissions:
      contents: read

    services:
      postgres:
        image: postgres@sha256:5fbbf7b4bd0c7f7faedb9814ec02cb8b639f44ccd5e81e5332e55e7b6b0f32b4  # v15.18
        env:
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
        with:
          persist-credentials: false
      - name: Set up Python
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405  # v6.2.0
        with:
          python-version: "3.14"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install "git+https://github.com/wagtail/wagtail.git@main#egg=wagtail"
          pip install -e .[testing]
      - name: Test
        id: test
        continue-on-error: true
        run: |
          cd tests
          python manage.py test
        env:
          DATABASE_ENGINE: django.db.backends.postgresql
          DATABASE_HOST: localhost
          DATABASE_USER: postgres
          DATABASE_PASS: postgres

      - name: Send Slack notification on failure
        if: steps.test.outcome == 'failure'
        run: |
          python .github/report_nightly_build_failure.py
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Nightly Wagtail test
 
on:
  schedule:
    - cron: "0 0 * * 1"
 
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
permissions:  {}
 
jobs:
  nightly-test:
    timeout-minutes: 30
    name: Nightly tests against Wagtail main
    # Cannot check the existence of secrets, so limiting to repository name to prevent all forks to run nightly.
    # See: https://github.com/actions/runner/issues/520
    if: ${{ github.repository == 'torchbox/wagtailmedia' }}
    runs-on: latchkey-small
    permissions:
      contents: read
 
    services:
      postgres:
        image: postgres@sha256:5fbbf7b4bd0c7f7faedb9814ec02cb8b639f44ccd5e81e5332e55e7b6b0f32b4  # v15.18
        env:
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
 
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
        with:
          persist-credentials: false
      - name: Set up Python
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405  # v6.2.0
        with:
          cache: 'pip'
          python-version: "3.14"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install "git+https://github.com/wagtail/wagtail.git@main#egg=wagtail"
          pip install -e .[testing]
      - name: Test
        id: test
        continue-on-error: true
        run: |
          cd tests
          python manage.py test
        env:
          DATABASE_ENGINE: django.db.backends.postgresql
          DATABASE_HOST: localhost
          DATABASE_USER: postgres
          DATABASE_PASS: postgres
 
      - name: Send Slack notification on failure
        if: steps.test.outcome == 'failure'
        run: |
          python .github/report_nightly_build_failure.py
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow