CI templates inconsistent between config/ci.rb.tt and github/ci.yml.tt for system tests
Steps to reproduce
The following reproduces on Rails 8.1.3 (where --skip-system-test is not yet the default). On Rails main (--skip-system-test is the default since PR #56272), the default case omits the system-test job entirely — but config/ci.rb remains commented out either way.
Case 1: default (rails new)
rails new myapp_default
cd myapp_default
# config/ci.rb — commented out
grep "test:system" config/ci.rb
# => # step "Tests: System", "bin/rails test:system"
# .github/workflows/ci.yml — active job (inconsistent)
grep "test:system" .github/workflows/ci.yml
# => run: bin/rails db:test:prepare test:systemCase 2: with system tests enabled
rails new myapp --no-skip-system-test
cd myapp
# config/ci.rb — still commented out despite explicit opt-in
grep "Tests: System" config/ci.rb
# => # step "Tests: System", "bin/rails test:system"
# .github/workflows/ci.yml — full active job
grep "test:system" .github/workflows/ci.yml
# => run: bin/rails db:test:prepare test:systemExpected behavior
Both CI templates should handle system tests consistently:
| Scenario | config/ci.rb.tt |
github/ci.yml.tt |
|---|---|---|
Default (rails new) |
Commented out | Commented out |
--no-skip-system-test |
Uncommented | Uncommented |
--api |
Omitted | Omitted |
Actual behavior
The two templates use different strategies, creating inconsistency:
| Scenario | config/ci.rb.tt |
github/ci.yml.tt |
|---|---|---|
| Default (before #56272) | Commented out | Uncommented |
| Default (after #56272) | Commented out | Omitted |
--no-skip-system-test |
Commented out | Uncommented |
--api |
Commented out | Omitted |
The inconsistency is in the template code itself, not just the generated output.
Root cause
config/ci.rb.ttalways comments out the system test step with an "Optional" note, regardless of flags.github/ci.yml.ttusesunless options[:api] || options[:skip_system_test], making its behavior depend on whether--skip-system-testis default or explicitly passed. When--no-skip-system-testis passed, it produces a full active job — butconfig/ci.rb.ttstill has it commented out.
The two templates were never updated together when --skip-system-test became the default (PR #56272).
Proposed fix
github/ci.yml.tt: Replace the flat guard with a nested structure:- Outer:
unless options[:api](skip entirely for API apps) - Inner:
if options[:skip_system_test] == false→ active job;else→ commented-out version with instructions on how to enable
- Outer:
config/ci.rb.tt: Add the same conditional logic.--apiomits the step entirely (not just commented out);--no-skip-system-testproduces an active step; default or--skip-system-testkeeps it commented out as optional.railties/test/generators/app_generator_test.rb: Update existing tests and add coverage for all three scenarios (default,--no-skip-system-test,--api).
Related
- #56853 — User reports failing CI on
rails new(notest/systemdirectory exists) - #56856 — Previous attempt to fix
ci.yml.ttonly (checks failed; missing--apihandling andci.rbchanges) - #56539 —
bin/cifails due to unguarded system test step (fixed in #56541) - #56272 — Made
--skip-system-testthe default - #55743 — Don't generate system tests by default
System configuration
Rails version: main (8.2.0.alpha)
Ruby version: N/A
Source: rails/rails