Skip to content

PHP

PHP CI on GitHub Actions

Composer install and PHPUnit both run cold every time.

70s → 5s
composer install
9m → 2m
PHPUnit

Composer install and PHPUnit both run cold every time.

Why it happens

The Composer cache directory is not persisted and PHPUnit runs serially by default.

What to change

  1. Cache ~/.composer/cache keyed on composer.lock
  2. Install with --prefer-dist --no-progress --no-interaction for predictable timing
  3. Use paratest to run PHPUnit across every core
  4. Enable OPcache in the CI php.ini — it helps more than people expect

PHP on runnerhut

yaml
jobs:
test:
runs-on: runnerhut-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with: { php-version: '8.4', extensions: pdo_mysql }
- run: composer install --prefer-dist --no-progress
- run: vendor/bin/paratest
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.