Skip to content

Commit b4514a9

Browse files
authored
Add Codecov setup (#823)
* Create codecov.yml * Add simplecov gem * Add simplecov config to test helper * Add coverage directory to gitignore * Replace minitest-rg with minitest and reporters * Migrate gemspec_lint.rb to regular test * Migrate test/gemfiles/lint.rb to regular test * Update gemfile test for current gemfile Since we run CI against each gemfile version, this test can just run against whatever the current gemfile is. * Update CI with code coverage upload Removed special cases since they have been migrated to normal tests. * Ran bundle update on all gemfiles * Update bin/bundle to accept all arguments * bin/bundle lock --add-platform x86_64-linux
1 parent 2888b88 commit b4514a9

File tree

14 files changed

+155
-54
lines changed

14 files changed

+155
-54
lines changed

.github/workflows/ci.yaml

+23-6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
- rails_60
2626
- rails_61
2727
- rails_70
28-
env:
29-
COVERAGE: true
3028
steps:
3129
- uses: actions/checkout@v3
3230
- name: Configure bundler (default)
@@ -42,8 +40,27 @@ jobs:
4240
ruby-version: ${{ matrix.ruby.value }}
4341
bundler-cache: true
4442
- name: Run tests
43+
env:
44+
COVERAGE: true
4545
run: bundle exec rake test TESTOPTS="--verbose"
46-
- name: Make sure gemfiles are up to date
47-
run: ruby -Itest -rbundler/setup -rgemfiles/lint -e 'exit(Minitest.run)'
48-
- name: Make sure gemspec builds without warnings
49-
run: ruby -Itest -rbundler/setup -rgemfiles/gemspec_lint -e 'exit(Minitest.run)'
46+
- uses: actions/upload-artifact@v3
47+
with:
48+
name: coverage
49+
path: coverage
50+
if-no-files-found: error
51+
52+
upload_coverage:
53+
name: Upload Coverage
54+
runs-on: ubuntu-latest
55+
needs:
56+
- test
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: actions/download-artifact@v3
60+
with:
61+
name: coverage
62+
path: coverage
63+
- uses: codecov/codecov-action@v3
64+
with:
65+
directory: coverage
66+
fail_ci_if_error: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.bundle
22
pkg
3+
coverage

Gemfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ group :development do
66
gem 'rails', '~> 7.0.0'
77

88
gem 'mocha'
9-
gem 'minitest-rg'
9+
gem 'minitest'
10+
gem 'minitest-reporters'
1011
gem 'rails-controller-testing'
12+
gem 'simplecov', require: false
13+
gem 'simplecov-cobertura'
1114
end
1215

1316
group :rubocop do

Gemfile.lock

+26-8
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ GEM
7575
i18n (>= 1.6, < 2)
7676
minitest (>= 5.1)
7777
tzinfo (~> 2.0)
78+
ansi (1.5.0)
7879
ast (2.4.2)
7980
builder (3.2.4)
8081
concurrent-ruby (1.2.2)
8182
crass (1.0.6)
8283
date (3.3.3)
8384
date (3.3.3-java)
85+
docile (1.4.0)
8486
erubi (1.12.0)
8587
globalid (1.1.0)
8688
activesupport (>= 5.0)
@@ -102,10 +104,12 @@ GEM
102104
marcel (1.0.2)
103105
method_source (1.0.0)
104106
mini_mime (1.1.2)
105-
mini_portile2 (2.8.1)
106107
minitest (5.18.0)
107-
minitest-rg (5.2.0)
108-
minitest (~> 5.0)
108+
minitest-reporters (1.6.0)
109+
ansi
110+
builder
111+
minitest (>= 5.0)
112+
ruby-progressbar
109113
mocha (2.0.2)
110114
ruby2_keywords (>= 0.0.5)
111115
net-imap (0.3.4)
@@ -119,18 +123,19 @@ GEM
119123
net-protocol
120124
nio4r (2.5.8)
121125
nio4r (2.5.8-java)
122-
nokogiri (1.14.2)
123-
mini_portile2 (~> 2.8.0)
126+
nokogiri (1.14.2-arm64-darwin)
124127
racc (~> 1.4)
125128
nokogiri (1.14.2-java)
126129
racc (~> 1.4)
130+
nokogiri (1.14.2-x86_64-linux)
131+
racc (~> 1.4)
127132
parallel (1.22.1)
128133
parser (3.2.1.1)
129134
ast (~> 2.4.1)
130135
racc (1.6.2)
131136
racc (1.6.2-java)
132137
rack (2.2.6.4)
133-
rack-test (2.0.2)
138+
rack-test (2.1.0)
134139
rack (>= 1.3)
135140
rails (7.0.4.3)
136141
actioncable (= 7.0.4.3)
@@ -183,6 +188,15 @@ GEM
183188
parser (>= 3.2.1.0)
184189
ruby-progressbar (1.13.0)
185190
ruby2_keywords (0.0.5)
191+
simplecov (0.22.0)
192+
docile (~> 1.1)
193+
simplecov-html (~> 0.11)
194+
simplecov_json_formatter (~> 0.1)
195+
simplecov-cobertura (2.1.0)
196+
rexml
197+
simplecov (~> 0.19)
198+
simplecov-html (0.12.3)
199+
simplecov_json_formatter (0.1.4)
186200
thor (1.2.1)
187201
timeout (0.3.2)
188202
tzinfo (2.0.6)
@@ -196,16 +210,20 @@ GEM
196210
zeitwerk (2.6.7)
197211

198212
PLATFORMS
213+
arm64-darwin-22
199214
java
200-
ruby
215+
x86_64-linux
201216

202217
DEPENDENCIES
203218
inherited_resources!
204-
minitest-rg
219+
minitest
220+
minitest-reporters
205221
mocha
206222
rails (~> 7.0.0)
207223
rails-controller-testing
208224
rubocop
225+
simplecov
226+
simplecov-cobertura
209227

210228
BUNDLED WITH
211229
2.4.8

bin/bundle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
( set -x; bundle $1 )
3+
( set -x; bundle $@ )
44

55
for gemfile in gemfiles/*/Gemfile; do
6-
( set -x; BUNDLE_GEMFILE="$gemfile" bundle $1 )
6+
( set -x; BUNDLE_GEMFILE="$gemfile" bundle $@ )
77
done

codecov.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
threshold: 0.05%

gemfiles/rails_60/Gemfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ group :development do
66
gem 'rails', '~> 6.0.3.a'
77

88
gem 'mocha'
9-
gem 'minitest-rg'
9+
gem 'minitest'
10+
gem 'minitest-reporters'
1011
gem 'rails-controller-testing'
12+
gem 'simplecov', require: false
13+
gem 'simplecov-cobertura'
1114
end

gemfiles/rails_60/Gemfile.lock

+29-9
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ GEM
6565
minitest (~> 5.1)
6666
tzinfo (~> 1.1)
6767
zeitwerk (~> 2.2, >= 2.2.2)
68+
ansi (1.5.0)
6869
builder (3.2.4)
6970
concurrent-ruby (1.2.2)
7071
crass (1.0.6)
7172
date (3.3.3)
7273
date (3.3.3-java)
74+
docile (1.4.0)
7375
erubi (1.12.0)
7476
globalid (1.1.0)
7577
activesupport (>= 5.0)
@@ -89,10 +91,12 @@ GEM
8991
marcel (1.0.2)
9092
method_source (1.0.0)
9193
mini_mime (1.1.2)
92-
mini_portile2 (2.8.1)
9394
minitest (5.18.0)
94-
minitest-rg (5.2.0)
95-
minitest (~> 5.0)
95+
minitest-reporters (1.6.0)
96+
ansi
97+
builder
98+
minitest (>= 5.0)
99+
ruby-progressbar
96100
mocha (2.0.2)
97101
ruby2_keywords (>= 0.0.5)
98102
net-imap (0.3.4)
@@ -106,15 +110,16 @@ GEM
106110
net-protocol
107111
nio4r (2.5.8)
108112
nio4r (2.5.8-java)
109-
nokogiri (1.14.2)
110-
mini_portile2 (~> 2.8.0)
113+
nokogiri (1.14.2-arm64-darwin)
111114
racc (~> 1.4)
112115
nokogiri (1.14.2-java)
113116
racc (~> 1.4)
117+
nokogiri (1.14.2-x86_64-linux)
118+
racc (~> 1.4)
114119
racc (1.6.2)
115120
racc (1.6.2-java)
116-
rack (2.2.6.3)
117-
rack-test (2.0.2)
121+
rack (2.2.6.4)
122+
rack-test (2.1.0)
118123
rack (>= 1.3)
119124
rails (6.0.6.1)
120125
actioncable (= 6.0.6.1)
@@ -150,7 +155,18 @@ GEM
150155
responders (3.1.0)
151156
actionpack (>= 5.2)
152157
railties (>= 5.2)
158+
rexml (3.2.5)
159+
ruby-progressbar (1.13.0)
153160
ruby2_keywords (0.0.5)
161+
simplecov (0.22.0)
162+
docile (~> 1.1)
163+
simplecov-html (~> 0.11)
164+
simplecov_json_formatter (~> 0.1)
165+
simplecov-cobertura (2.1.0)
166+
rexml
167+
simplecov (~> 0.19)
168+
simplecov-html (0.12.3)
169+
simplecov_json_formatter (0.1.4)
154170
sprockets (4.2.0)
155171
concurrent-ruby (~> 1.0)
156172
rack (>= 2.2.4, < 4)
@@ -172,15 +188,19 @@ GEM
172188
zeitwerk (2.6.7)
173189

174190
PLATFORMS
191+
arm64-darwin-22
175192
java
176-
ruby
193+
x86_64-linux
177194

178195
DEPENDENCIES
179196
inherited_resources!
180-
minitest-rg
197+
minitest
198+
minitest-reporters
181199
mocha
182200
rails (~> 6.0.3.a)
183201
rails-controller-testing
202+
simplecov
203+
simplecov-cobertura
184204

185205
BUNDLED WITH
186206
2.4.8

gemfiles/rails_61/Gemfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ group :development do
66
gem 'rails', '~> 6.1.0'
77

88
gem 'mocha'
9-
gem 'minitest-rg'
9+
gem 'minitest'
10+
gem 'minitest-reporters'
1011
gem 'rails-controller-testing'
12+
gem 'simplecov', require: false
13+
gem 'simplecov-cobertura'
1114
end

gemfiles/rails_61/Gemfile.lock

+28-8
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ GEM
6969
minitest (>= 5.1)
7070
tzinfo (~> 2.0)
7171
zeitwerk (~> 2.3)
72+
ansi (1.5.0)
7273
builder (3.2.4)
7374
concurrent-ruby (1.2.2)
7475
crass (1.0.6)
7576
date (3.3.3)
7677
date (3.3.3-java)
78+
docile (1.4.0)
7779
erubi (1.12.0)
7880
globalid (1.1.0)
7981
activesupport (>= 5.0)
@@ -93,10 +95,12 @@ GEM
9395
marcel (1.0.2)
9496
method_source (1.0.0)
9597
mini_mime (1.1.2)
96-
mini_portile2 (2.8.1)
9798
minitest (5.18.0)
98-
minitest-rg (5.2.0)
99-
minitest (~> 5.0)
99+
minitest-reporters (1.6.0)
100+
ansi
101+
builder
102+
minitest (>= 5.0)
103+
ruby-progressbar
100104
mocha (2.0.2)
101105
ruby2_keywords (>= 0.0.5)
102106
net-imap (0.3.4)
@@ -110,15 +114,16 @@ GEM
110114
net-protocol
111115
nio4r (2.5.8)
112116
nio4r (2.5.8-java)
113-
nokogiri (1.14.2)
114-
mini_portile2 (~> 2.8.0)
117+
nokogiri (1.14.2-arm64-darwin)
115118
racc (~> 1.4)
116119
nokogiri (1.14.2-java)
117120
racc (~> 1.4)
121+
nokogiri (1.14.2-x86_64-linux)
122+
racc (~> 1.4)
118123
racc (1.6.2)
119124
racc (1.6.2-java)
120125
rack (2.2.6.4)
121-
rack-test (2.0.2)
126+
rack-test (2.1.0)
122127
rack (>= 1.3)
123128
rails (6.1.7.3)
124129
actioncable (= 6.1.7.3)
@@ -154,7 +159,18 @@ GEM
154159
responders (3.1.0)
155160
actionpack (>= 5.2)
156161
railties (>= 5.2)
162+
rexml (3.2.5)
163+
ruby-progressbar (1.13.0)
157164
ruby2_keywords (0.0.5)
165+
simplecov (0.22.0)
166+
docile (~> 1.1)
167+
simplecov-html (~> 0.11)
168+
simplecov_json_formatter (~> 0.1)
169+
simplecov-cobertura (2.1.0)
170+
rexml
171+
simplecov (~> 0.19)
172+
simplecov-html (0.12.3)
173+
simplecov_json_formatter (0.1.4)
158174
sprockets (4.2.0)
159175
concurrent-ruby (~> 1.0)
160176
rack (>= 2.2.4, < 4)
@@ -174,15 +190,19 @@ GEM
174190
zeitwerk (2.6.7)
175191

176192
PLATFORMS
193+
arm64-darwin-22
177194
java
178-
ruby
195+
x86_64-linux
179196

180197
DEPENDENCIES
181198
inherited_resources!
182-
minitest-rg
199+
minitest
200+
minitest-reporters
183201
mocha
184202
rails (~> 6.1.0)
185203
rails-controller-testing
204+
simplecov
205+
simplecov-cobertura
186206

187207
BUNDLED WITH
188208
2.4.8

test/gemfiles/lint.rb

-17
This file was deleted.

0 commit comments

Comments
 (0)