class method
self.run
Ruby on Rails edge
Since v8.1.3.1Available in: v8.1.3.1 edge
Signature
self.run(title = "Continuous Integration", subtitle = "Running tests, style checks, and security audits", &block)
Perform a CI run. Execute each step, show their results and runtime, and exit with a non-zero status if there are any failures.
Pass an optional title, subtitle, and a block that declares the steps to be executed.
Sets the CI environment variable to “true” to allow for conditional behavior in the app, like enabling eager loading and disabling logging.
A ‘fail fast’ option can be passed as a CLI argument (-f or –fail-fast). This exits with a non-zero status directly after a step fails.
Example:
ActiveSupport::ContinuousIntegration.run do
step "Setup", "bin/setup --skip-server"
step "Style: Ruby", "bin/rubocop"
step "Security: Gem audit", "bin/bundler-audit"
step "Tests: Rails", "bin/rails test test:system"
if success?
step "Signoff: Ready for merge and deploy", "gh signoff"
else
failure "Skipping signoff; CI failed.", "Fix the issues and try again."
end
end
Parameters
-
titleopt = "Continuous Integration" -
subtitleopt = "Running tests -
style checksreq -
and security audits"req -
blockblock
Source
# File activesupport/lib/active_support/continuous_integration.rb, line 63
def self.run(title = "Continuous Integration", subtitle = "Running tests, style checks, and security audits", &block)
ENV["CI"] = "true"
new.tap { |ci| ci.run(title, subtitle, &block) }
end
Defined in activesupport/lib/active_support/continuous_integration.rb line 63
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::ContinuousIntegration