diff --git a/CODEOWNERS b/CODEOWNERS index 9863f35b..64cbf4e9 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,2 @@ # Setting ownership to the tooling team and Tim -* @puppetlabs/tooling @bastelfreak +* @puppetlabs/devx @bastelfreak diff --git a/Gemfile b/Gemfile index e6ed6f28..a7906ba6 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,6 @@ end group :development do gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) - gem 'codecov' gem 'simplecov' gem 'simplecov-console' diff --git a/README.md b/README.md index 1f2cfbeb..ebc7fb8d 100644 --- a/README.md +++ b/README.md @@ -410,7 +410,7 @@ You can enable it, set the following environment variable:s ``SIMPLECOV=yes`` -Remember to add the simplecov-console and codecov gems to your `Gemfile`. If you run `spec:simplecov` on Travis-CI or any of the other supported CI services, reports gets automatically uploaded to https://codecov.io/ . +Remember to add the simplecov-console gem to your `Gemfile`. If you run `spec:simplecov` on Travis-CI or any of the other supported CI services, reports get generated which can then be uploaded to [codecov.io](https://codecov.io) with the recommended [codecov uploader](https://docs.codecov.com/docs/codecov-uploader). Some Notes for Windows Users ============================ diff --git a/lib/puppetlabs_spec_helper/module_spec_helper.rb b/lib/puppetlabs_spec_helper/module_spec_helper.rb index 412c0a9e..f0f2330e 100644 --- a/lib/puppetlabs_spec_helper/module_spec_helper.rb +++ b/lib/puppetlabs_spec_helper/module_spec_helper.rb @@ -20,35 +20,42 @@ def verify_contents(subject, title, expected_lines) module_path = File.join(fixture_path, 'modules') module_path = [module_path, env_module_path].join(File::PATH_SEPARATOR) if env_module_path + if ENV['SIMPLECOV'] == 'yes' begin require 'simplecov' require 'simplecov-console' + rescue LoadError + raise 'Add the simplecov and simplecov-console gems to Gemfile to enable this task' + end + + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console + ] + + begin require 'codecov' + SimpleCov.formatters << SimpleCov::Formatter::Codecov + rescue LoadError + # continue without codecov, we could warn here but we want to avoid its use if possible + end + + SimpleCov.start do + track_files 'lib/**/*.rb' + add_filter '/spec' - SimpleCov.formatters = [ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console, - SimpleCov::Formatter::Codecov - ] - SimpleCov.start do - track_files 'lib/**/*.rb' - add_filter '/spec' - - # do not track vendored files - add_filter '/vendor' - add_filter '/.vendor' - - # do not track gitignored files - # this adds about 4 seconds to the coverage check - # this could definitely be optimized - add_filter do |f| - # system returns true if exit status is 0, which with git-check-ignore means file is ignored - system("git check-ignore --quiet #{f.filename}") - end + # do not track vendored files + add_filter '/vendor' + add_filter '/.vendor' + + # do not track gitignored files + # this adds about 4 seconds to the coverage check + # this could definitely be optimized + add_filter do |f| + # system returns true if exit status is 0, which with git-check-ignore means file is ignored + system("git check-ignore --quiet #{f.filename}") end - rescue LoadError - raise 'Add the simplecov, simplecov-console, codecov gems to Gemfile to enable this task' end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7d6844ed..22b1f0ff 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,30 +4,32 @@ begin require 'simplecov' require 'simplecov-console' + rescue LoadError + raise 'Add the simplecov and simplecov-console gems to Gemfile to enable this task' + end - SimpleCov.formatters = [ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console - ] + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console + ] - if ENV['CI'] == 'true' - require 'codecov' - SimpleCov.formatters << SimpleCov::Formatter::Codecov - end + begin + require 'codecov' + SimpleCov.formatters << SimpleCov::Formatter::Codecov + rescue LoadError + # continue without codecov, we could warn here but we want to avoid if possible + end - SimpleCov.start do - track_files 'lib/**/*.rb' + SimpleCov.start do + track_files 'lib/**/*.rb' - add_filter 'lib/puppetlabs_spec_helper/version.rb' + add_filter 'lib/puppetlabs_spec_helper/version.rb' - add_filter '/spec' + add_filter '/spec' - # do not track vendored files - add_filter '/vendor' - add_filter '/.vendor' - end - rescue LoadError - raise 'Add the simplecov, simplecov-console, codecov gems to Gemfile to enable this task' + # do not track vendored files + add_filter '/vendor' + add_filter '/.vendor' end end