Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise an exception if tests or changelog generation fails #294

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
bundler-cache: true
- name: test
run: bundle exec rake test
env:
ERROR_ON_TEST_FAILURE: "false"
- name: internal_investigation
run: bundle exec rake internal_investigation

Expand Down Expand Up @@ -84,3 +86,5 @@ jobs:
bundler-cache: true
- name: test
run: bundle exec rake test
env:
ERROR_ON_TEST_FAILURE: "false"
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ require_relative 'lib/rubocop/cop/generator'

desc 'Run tests'
task :test do
system("bundle exec minitest-queue #{Dir.glob('test/**/*_test.rb').shelljoin}")
error_on_failure = ENV.fetch('ERROR_ON_TEST_FAILURE', 'true') != 'false'

system("bundle exec minitest-queue #{Dir.glob('test/**/*_test.rb').shelljoin}", exception: error_on_failure)
Comment on lines +24 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any problem with always setting it to true for exception option?

Suggested change
error_on_failure = ENV.fetch('ERROR_ON_TEST_FAILURE', 'true') != 'false'
system("bundle exec minitest-queue #{Dir.glob('test/**/*_test.rb').shelljoin}", exception: error_on_failure)
system("bundle exec minitest-queue #{Dir.glob('test/**/*_test.rb').shelljoin}", exception: true)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, two of the jobs are currently failing and I think fixing them should be done in dedicated PRs - once they're fixed, this can then be set to true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK. Let's merge this first 👍

end

desc 'Run RuboCop over itself'
Expand Down
4 changes: 2 additions & 2 deletions tasks/changelog.rake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace :changelog do
ref_type = :pull if args[:id]
path = Changelog::Entry.new(type: type, ref_id: args[:id], ref_type: ref_type).write
cmd = "git add #{path}"
system cmd
system cmd, exception: true
puts "Entry '#{path}' created and added to git index"
end
end
Expand All @@ -21,7 +21,7 @@ namespace :changelog do
Changelog.new.merge!.and_delete!
cmd = "git commit -a -m 'Update Changelog'"
puts cmd
system cmd
system cmd, exception: true
end

task :check_clean do
Expand Down