summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml1
-rw-r--r--features/support/env.rb1
-rwxr-xr-xscripts/merge-simplecov4
-rw-r--r--spec/simplecov_env.rb35
-rw-r--r--spec/spec_helper.rb1
5 files changed, 26 insertions, 16 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aa22bf688a0..1ca266ef4f1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,6 +28,7 @@ stages:
- prepare
- test
- post-test
+- pages
# Prepare and merge knapsack tests
.knapsack-state: &knapsack-state
diff --git a/features/support/env.rb b/features/support/env.rb
index 1c39367ad42..16ce1b6ca77 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,4 +1,5 @@
require_relative Rails.root.join('spec', 'simplecov_env')
+SimpleCov.start if ENV['SIMPLECOV']
ENV['RAILS_ENV'] = 'test'
require './config/environment'
diff --git a/scripts/merge-simplecov b/scripts/merge-simplecov
index b59ff0ae9a0..0d764d2b406 100755
--- a/scripts/merge-simplecov
+++ b/scripts/merge-simplecov
@@ -58,8 +58,6 @@ def merged_result
result
end
-SimpleCov.configure do
- merge_timeout 7200
-end
+require_relative '../spec/simplecov_env'
merged_result.format!
diff --git a/spec/simplecov_env.rb b/spec/simplecov_env.rb
index a833255d407..956476fd065 100644
--- a/spec/simplecov_env.rb
+++ b/spec/simplecov_env.rb
@@ -1,18 +1,27 @@
-if ENV['SIMPLECOV']
- require 'simplecov'
+require 'simplecov'
- SimpleCov.start :rails do
- if ENV['CI_BUILD_NAME']
- coverage_dir "coverage/#{ENV['CI_BUILD_NAME']}"
- command_name ENV['CI_BUILD_NAME']
- merge_timeout 7200
- end
+SimpleCov.configure do
+ load_profile :rails
- add_filter '/vendor/ruby/'
+ if ENV['CI_BUILD_NAME']
+ coverage_dir "coverage/#{ENV['CI_BUILD_NAME']}"
+ command_name ENV['CI_BUILD_NAME']
+ end
- add_group 'Services', 'app/services'
- add_group 'Finders', 'app/finders'
- add_group 'Uploaders', 'app/uploaders'
- add_group 'Validators', 'app/validators'
+ if ENV['CI']
+ SimpleCov.at_exit do
+ # In CI environment don't generate formatted reports
+ # Only generate .resultset.json
+ SimpleCov.result
+ end
end
+
+ add_filter '/vendor/ruby/'
+
+ add_group 'Services', 'app/services'
+ add_group 'Finders', 'app/finders'
+ add_group 'Uploaders', 'app/uploaders'
+ add_group 'Validators', 'app/validators'
+
+ merge_timeout 7200
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6a882bea571..d2760d0ef28 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,5 @@
require_relative 'simplecov_env'
+SimpleCov.start if ENV['SIMPLECOV']
ENV["RAILS_ENV"] ||= 'test'