Conditionally skip test job in ci.yml (#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 <rafael@rubyonrails.org>
This commit is contained in:
Steve Polito 2024-03-25 16:55:20 -04:00 committed by GitHub
parent 98b3183356
commit 7242fd7f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,8 @@
* Skip generating a `test` job in ci.yml when a new application is generated with the
`--skip-test` option.
*Steve Polito*
* Update the `.node-version` file conditionally generated for new applications to 20.11.1
*Steve Polito*

View File

@ -59,6 +59,7 @@ jobs:
run: bin/rubocop -f github
<% end -%>
<% unless options[:skip_test] -%>
test:
runs-on: ubuntu-latest
@ -134,3 +135,4 @@ jobs:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore
<% end -%>

View File

@ -534,6 +534,10 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_no_gem "selenium-webdriver"
assert_no_directory("test")
assert_file ".github/workflows/ci.yml" do |file|
assert_no_match(/test:.\s*runs-on/m, file)
end
end
def test_generator_if_skip_jbuilder_is_given