Skip to content

Commit

Permalink
Merge pull request #294 from G-Rath/error-on-tests-failure
Browse files Browse the repository at this point in the history
Raise an exception if tests or changelog generation fails
  • Loading branch information
koic authored Jan 3, 2024
2 parents 88c38c1 + 03c86d3 commit f47bcbd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
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)
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

0 comments on commit f47bcbd

Please sign in to comment.