Skip to content

Django

Django CI on GitHub Actions

Tests wait on a database container and run on a single core.

16m → 3m
Test suite
70s → 0s
Migrations

Tests wait on a database container and run on a single core.

Why it happens

A service container starts cold each run and Django's test runner is serial by default.

What to change

  1. Run tests with --parallel auto to fork across every core
  2. Use --keepdb so migrations are not replayed on every run
  3. Cache the virtualenv and use uv for install
  4. Start Postgres as a service container with a tmpfs data directory

Django on runnerhut

yaml
jobs:
test:
runs-on: runnerhut-8vcpu-ubuntu-2404
services:
postgres:
image: postgres:17
env: { POSTGRES_PASSWORD: postgres }
options: >-
--health-cmd pg_isready --health-interval 5s
steps:
- uses: actions/checkout@v4
- run: uv sync --frozen
- run: uv run python manage.py test --parallel auto --keepdb
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-8vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.