Skip to content

Commit 7242fd7

Browse files
Conditionally skip test job in ci.yml (rails#51289)
Skip generating a `test` job in ci.yml when a new application is generated with the `--skip-test` option. Co-authored-by: Rafael Mendonça França <[email protected]>
1 parent 98b3183 commit 7242fd7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

railties/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Skip generating a `test` job in ci.yml when a new application is generated with the
2+
`--skip-test` option.
3+
4+
*Steve Polito*
5+
16
* Update the `.node-version` file conditionally generated for new applications to 20.11.1
27

38
*Steve Polito*

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
@@ -59,6 +59,7 @@ jobs:
5959
run: bin/rubocop -f github
6060

6161
<% end -%>
62+
<% unless options[:skip_test] -%>
6263
test:
6364
runs-on: ubuntu-latest
6465

@@ -134,3 +135,4 @@ jobs:
134135
name: screenshots
135136
path: ${{ github.workspace }}/tmp/screenshots
136137
if-no-files-found: ignore
138+
<% end -%>

railties/test/generators/app_generator_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,10 @@ def test_generator_if_skip_test_is_given
534534
assert_no_gem "selenium-webdriver"
535535

536536
assert_no_directory("test")
537+
538+
assert_file ".github/workflows/ci.yml" do |file|
539+
assert_no_match(/test:.\s*runs-on/m, file)
540+
end
537541
end
538542

539543
def test_generator_if_skip_jbuilder_is_given

0 commit comments

Comments
 (0)