Skip to content

Commit 0cfaac8

Browse files
committed
Don't generate the step for system tests when an application is API-only
When an application is API-only, we don't run system tests. https://github.com/rails/rails/blob/ad4d2d2b5bdd4226b76d85c73500de0a9d48f7c2/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt#L129-L133 So keeping screenshots isn't needed too.
1 parent ad4d2d2 commit 0cfaac8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ jobs:
131131
<%- else -%>
132132
run: bin/rails db:test:prepare test test:system
133133
<%- end -%>
134+
<%- unless options[:api] -%>
134135

135136
- name: Keep screenshots from failed system tests
136137
uses: actions/upload-artifact@v4
@@ -139,4 +140,5 @@ jobs:
139140
name: screenshots
140141
path: ${{ github.workspace }}/tmp/screenshots
141142
if-no-files-found: ignore
143+
<%- end -%>
142144
<% end -%>

railties/test/generators/api_app_generator_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def test_api_modified_files
5757
assert_file "config/environments/production.rb" do |content|
5858
assert_no_match(/action_controller\.perform_caching = true/, content)
5959
end
60+
61+
assert_file ".github/workflows/ci.yml" do |content|
62+
assert_no_match(/test:system/, content)
63+
assert_no_match(/screenshots/, content)
64+
end
6065
end
6166

6267
def test_dockerfile

0 commit comments

Comments
 (0)