Skip to content

Rails

Rails CI on GitHub Actions

Asset precompilation and native gem builds dominate the pipeline.

3m → 20s
Asset precompile
24m → 5m
Test suite

Asset precompilation and native gem builds dominate the pipeline.

Why it happens

vendor/bundle, node_modules and tmp/cache/assets are all cold on every run.

What to change

  1. Cache vendor/bundle, node_modules and tmp/cache/assets together
  2. Run RSpec with parallel_tests across all cores
  3. Precompile assets only in the deploy job, not in the test job
  4. Use a snapshot runner so bundle install disappears completely

Rails on runnerhut

yaml
jobs:
test:
runs-on: runnerhut-8vcpu-ubuntu-2404
services:
postgres: { image: postgres:17, env: { POSTGRES_PASSWORD: postgres } }
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with: { bundler-cache: true }
- run: bundle exec rails db:test:prepare
- run: bundle exec parallel_rspec spec/
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.