File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ commands:
153153 - run :
154154 name : " Prepare the rails application"
155155 command : |
156+ cp core/spec/solidus_install_coverage.rb /tmp/solidus_install_coverage.rb
156157 cd /tmp
157158 test -d my_app || (gem install rails -v "< 7.1" && gem install solidus)
158159 test -d my_app || rails new my_app --skip-git
@@ -165,9 +166,16 @@ commands:
165166 name : " Run `solidus:install` with `<<parameters.flags>>`"
166167 command : |
167168 cd /tmp/my_app
169+ bundle add gem simplecov simplecov-cobertura --require=false
168170 bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
169171 unset RAILS_ENV # avoid doing everything on the test environment
172+ cat /tmp/solidus_install_coverage.rb >> config/boot.rb
170173 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
171179
172180 test_page :
173181 parameters :
@@ -236,6 +244,10 @@ jobs:
236244 executor :
237245 name : sqlite
238246 ruby : " 3.0"
247+ environment :
248+ COVERAGE : " true"
249+ COVERAGE_DIR : /tmp/coverage
250+ DISABLE_ACTIVE_STORAGE : false
239251 steps :
240252 - checkout
241253 - run :
@@ -264,6 +276,8 @@ jobs:
264276 name : " Ensure solidus_frontend installer is run"
265277 command : |
266278 test -f /tmp/dummy_extension/spec/dummy/config/initializers/solidus_frontend.rb
279+ - codecov/upload :
280+ file : /tmp/coverage/coverage.xml
267281
268282 test_solidus :
269283 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+
14+ # When the file is executed directly, run the coverage report
15+ if __FILE__ == $PROGRAM_NAME
16+ require "simplecov"
17+ SimpleCov . merge_timeout 3600
18+ SimpleCov . coverage_dir ( ENV [ "COVERAGE_DIR" ] )
19+ require "simplecov-cobertura"
20+ SimpleCov . formatter = SimpleCov ::Formatter ::CoberturaFormatter
21+ SimpleCov . result . format!
22+ end
You can’t perform that action at this time.
0 commit comments