File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ commands:
153
153
- run :
154
154
name : " Prepare the rails application"
155
155
command : |
156
+ cp core/spec/solidus_install_coverage.rb /tmp/solidus_install_coverage.rb
156
157
cd /tmp
157
158
test -d my_app || (gem install rails -v "< 7.1" && gem install solidus)
158
159
test -d my_app || rails new my_app --skip-git
@@ -165,9 +166,16 @@ commands:
165
166
name : " Run `solidus:install` with `<<parameters.flags>>`"
166
167
command : |
167
168
cd /tmp/my_app
169
+ bundle add gem simplecov simplecov-cobertura --require=false
168
170
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
169
171
unset RAILS_ENV # avoid doing everything on the test environment
172
+ cat /tmp/solidus_install_coverage.rb >> config/boot.rb
170
173
bin/rails generate solidus:install --auto-accept <<parameters.flags>>
174
+ - run :
175
+ name : Report Coverage
176
+ command : |
177
+ cd /tmp/my_app
178
+ bundle exec ruby /tmp/solidus_install_coverage.rb
171
179
172
180
test_page :
173
181
parameters :
@@ -236,6 +244,10 @@ jobs:
236
244
executor :
237
245
name : sqlite
238
246
ruby : " 3.0"
247
+ environment :
248
+ COVERAGE : " true"
249
+ COVERAGE_DIR : /tmp/coverage
250
+ DISABLE_ACTIVE_STORAGE : false
239
251
steps :
240
252
- checkout
241
253
- run :
@@ -264,6 +276,8 @@ jobs:
264
276
name : " Ensure solidus_frontend installer is run"
265
277
command : |
266
278
test -f /tmp/dummy_extension/spec/dummy/config/initializers/solidus_frontend.rb
279
+ - codecov/upload :
280
+ file : /tmp/coverage/coverage.xml
267
281
268
282
test_solidus :
269
283
parameters :
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ if ENV [ "COVERAGE" ]
4
+ require 'simplecov'
5
+ if ENV [ "COVERAGE_DIR" ]
6
+ SimpleCov . coverage_dir ( ENV [ "COVERAGE_DIR" ] )
7
+ end
8
+ SimpleCov . command_name ( 'solidus:install' )
9
+ SimpleCov . merge_timeout ( 3600 )
10
+ SimpleCov . start ( 'rails' )
11
+ end
12
+
13
+ # When the file is executed directly, run the coverage report
14
+ if __FILE__ == $PROGRAM_NAME
15
+ require "simplecov"
16
+ SimpleCov . merge_timeout 3600
17
+ SimpleCov . coverage_dir ( ENV [ "COVERAGE_DIR" ] )
18
+ require "simplecov-cobertura"
19
+ SimpleCov . formatter = SimpleCov ::Formatter ::CoberturaFormatter
20
+ SimpleCov . result . format!
21
+ end
You can’t perform that action at this time.
0 commit comments