Make your CI config simpler with ActiveSupport::ContinuousIntegration

Posted . Visible to the public.

Rails 8.1 ships the new ActiveSupport::ContinuousIntegration Show archive.org snapshot class. It allows you to list multiple steps. It will run all of them and fail if any of them exited non-0.

The new Rails default seems to be a bin/ci file that's a small entry point and the real list of steps living in config/ci.rb. This seems like unnecessary indirection to me. I'd rather propose to split this into multiple coarse categories.

# bin/audit

#!/usr/bin/env ruby

require_relative "../config/boot"
require "active_support/continuous_integration"

ActiveSupport::ContinuousIntegration.run do
  step "Setup", "bin/setup --skip-server"

  step "Security: Rubygems audit", "bundle", "audit"
  step "Security: NPM audit", "npm", "audit"
  step "Security: Importmap vulnerability audit", "bin/importmap", "audit"
end
# bin/lint

#!/usr/bin/env ruby

require_relative "../config/boot"
require "active_support/continuous_integration"

ActiveSupport::ContinuousIntegration.run do
  step "Setup", "bin/setup --skip-server"

  step "Style: Ruby", "bin/rubocop"
  step "Style: JS", "npx prettier", ".", "--check"
  step "Style: CSS", "npx stylelint", "**/*.{css,scss,sass}"
  step "Autoloading: Ruby", "bin/rails", "zeitwerk:check"
  step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
  step "Tests: Factories", "bin/rails", "factory_bot:lint"
  step "Security: Brakeman code analysis", "bin/brakeman", "--quiet", "--no-pager", "--exit-on-warn", "--exit-on-error"
end
# bin/ci

#!/usr/bin/env ruby

require_relative "../config/boot"
require "active_support/continuous_integration"

ActiveSupport::ContinuousIntegration.run do
  step "Setup", "bin/setup --skip-server"

  step "Tests: Rails", "bin/rails", "test", "test:system"
end

This way, unless you install a new package, you never need to run bin/audit locally (as long as those checks still run in your CI) and have a single command for "run tests" and "run everything else".

Profile picture of Klaus Weidinger
Klaus Weidinger
Last edit
Klaus Weidinger
License
Source code in this card is licensed under the MIT License.
Posted by Klaus Weidinger to makandra dev (2026-08-26 13:43)