Skip to content

Commit 3af4067

Browse files
committed
Add code coverage check
1 parent ad0fc1c commit 3af4067

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

.github/workflows/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ jobs:
6767
- name: Run linters and tests
6868
run: bundle exec rake
6969

70+
- name: Code coverage
71+
uses: joshmfrankel/simplecov-check-action@main
72+
with:
73+
github_token: ${{ secrets.GITHUB_TOKEN }}
74+
minimum_suite_coverage: 96
75+
7076
call-build-and-deploy:
7177
if: ${{ github.ref == 'refs/heads/main' }}
7278
needs: test

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ group :test do
4848
gem "rubocop-govuk", require: false
4949
gem "selenium-webdriver"
5050
gem "simplecov", require: false
51-
gem "simplecov-rcov"
51+
gem "simplecov-json", require: false
5252
end

Gemfile.lock

+4-3
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,9 @@ GEM
375375
simplecov-html (~> 0.11)
376376
simplecov_json_formatter (~> 0.1)
377377
simplecov-html (0.12.3)
378-
simplecov-rcov (0.3.1)
379-
simplecov (>= 0.4.1)
378+
simplecov-json (0.2.3)
379+
json
380+
simplecov
380381
simplecov_json_formatter (0.1.4)
381382
smart_properties (1.17.0)
382383
sprockets (3.7.2)
@@ -451,7 +452,7 @@ DEPENDENCIES
451452
sentry-rails
452453
sentry-ruby
453454
simplecov
454-
simplecov-rcov
455+
simplecov-json
455456
uglifier
456457
virtus
457458

spec/spec_helper.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ENV["RAILS_ENV"] ||= "test"
22

33
require "simplecov"
4-
SimpleCov.minimum_coverage 100
5-
6-
SimpleCov.start do
7-
add_filter "spec/support"
8-
add_filter "spec/rails_helper.rb"
9-
add_filter "config/initializers"
10-
add_filter "config/routes.rb"
4+
require "simplecov-json"
5+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
6+
SimpleCov::Formatter::HTMLFormatter,
7+
SimpleCov::Formatter::JSONFormatter,
8+
])
9+
SimpleCov.start "rails" do
10+
add_filter %r{^/lib/}
1111
end
1212

1313
Dir["./spec/support/**/*.rb"].each { |f| require f }

0 commit comments

Comments
 (0)