Skip to content

Laravel

Laravel CI on GitHub Actions

Composer install and Pest both start cold, and MySQL takes time to become healthy.

80s → 5s
Install
7m → 2m
Test suite

Composer install and Pest both start cold, and MySQL takes time to become healthy.

Why it happens

The Composer cache is not persisted and the database service container has no readiness tuning.

What to change

  1. Cache ~/.composer/cache and vendor/ keyed on composer.lock
  2. Run Pest or PHPUnit in parallel with --parallel
  3. Use a tmpfs volume for MySQL data so tests are not disk-bound
  4. Cache the Laravel config and route caches for faster boot

Laravel on runnerhut

yaml
jobs:
test:
runs-on: runnerhut-4vcpu-ubuntu-2404
services:
mysql:
image: mysql:8
env: { MYSQL_ROOT_PASSWORD: root, MYSQL_DATABASE: testing }
steps:
- uses: actions/checkout@v4
- run: composer install --prefer-dist --no-progress
- run: php artisan test --parallel
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-4vcpu-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.