From abbf0c69e1bcaafebc5aa4f8da22fdb64ce62149 Mon Sep 17 00:00:00 2001 From: Sina Eftekhar Date: Thu, 10 Aug 2023 10:42:29 +0300 Subject: [PATCH] Fix codecov/simplecov configurations --- .simplecov | 34 +++++-- Gemfile | 4 - Gemfile.lock | 219 ++++++++++++++++++++++---------------------- spec/spec_helper.rb | 7 -- 4 files changed, 134 insertions(+), 130 deletions(-) diff --git a/.simplecov b/.simplecov index 1a61775..6117940 100644 --- a/.simplecov +++ b/.simplecov @@ -1,12 +1,32 @@ # frozen_string_literal: true -SimpleCov.start do - root ENV.fetch("ENGINE_ROOT", nil) +if ENV["SIMPLECOV"] + SimpleCov.start do + # `ENGINE_ROOT` holds the name of the engine we are testing. + # This brings us to the main Decidim folder. + root ENV.fetch("ENGINE_ROOT", nil) - add_filter "lib/decidim/term_customizer/version.rb" - add_filter "/spec" -end + # We make sure we track all Ruby files, to avoid skipping unrequired files + # We need to include the `../` section, otherwise it only tracks files from the + # `ENGINE_ROOT` folder for some reason. + track_files "**/*.rb" + + # We ignore some of the files because they are never tested + add_filter "/config/" + add_filter "/db/" + add_filter "/vendor/" + add_filter "/spec/" + add_filter "/test/" + add_filter %r{^/lib/decidim/[^/]*/engine.rb} + add_filter %r{^/lib/decidim/[^/]*/admin_engine.rb} + add_filter %r{^/lib/decidim/[^/]*/component.rb} + add_filter %r{^/lib/decidim/[^/]*/participatory_space.rb} + end -SimpleCov.command_name ENV.fetch("COMMAND_NAME", nil) || File.basename(Dir.pwd) + SimpleCov.merge_timeout 1800 -SimpleCov.merge_timeout 1800 + if ENV["CI"] + require "simplecov-cobertura" + SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter + end +end diff --git a/Gemfile b/Gemfile index 6d85fe5..aec26c5 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,3 @@ group :development do gem "spring-watcher-listen", "~> 2.0" gem "web-console", "~> 4.2" end - -group :test do - gem "codecov", require: false -end diff --git a/Gemfile.lock b/Gemfile.lock index 9e0b129..896e1ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,7 +72,7 @@ GEM zeitwerk (~> 2.3) acts_as_list (0.9.19) activerecord (>= 3.0) - addressable (2.8.4) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) axe-core-api (4.7.0) @@ -134,8 +134,6 @@ GEM chef-utils (18.2.7) concurrent-ruby childprocess (4.1.0) - codecov (0.6.0) - simplecov (>= 0.15, < 0.22) coercible (1.0.0) descendants_tracker (~> 0.0.1) coffee-rails (5.0.0) @@ -145,7 +143,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - commonmarker (0.23.9) + commonmarker (0.23.10) concurrent-ruby (1.2.2) crack (0.4.5) rexml @@ -160,57 +158,57 @@ GEM db-query-matchers (0.10.0) activesupport (>= 4.0, < 7) rspec (~> 3.0) - decidim (0.27.3) - decidim-accountability (= 0.27.3) - decidim-admin (= 0.27.3) - decidim-api (= 0.27.3) - decidim-assemblies (= 0.27.3) - decidim-blogs (= 0.27.3) - decidim-budgets (= 0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-debates (= 0.27.3) - decidim-forms (= 0.27.3) - decidim-generators (= 0.27.3) - decidim-meetings (= 0.27.3) - decidim-pages (= 0.27.3) - decidim-participatory_processes (= 0.27.3) - decidim-proposals (= 0.27.3) - decidim-sortitions (= 0.27.3) - decidim-surveys (= 0.27.3) - decidim-system (= 0.27.3) - decidim-templates (= 0.27.3) - decidim-verifications (= 0.27.3) - decidim-accountability (0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-admin (0.27.3) + decidim (0.27.4) + decidim-accountability (= 0.27.4) + decidim-admin (= 0.27.4) + decidim-api (= 0.27.4) + decidim-assemblies (= 0.27.4) + decidim-blogs (= 0.27.4) + decidim-budgets (= 0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-debates (= 0.27.4) + decidim-forms (= 0.27.4) + decidim-generators (= 0.27.4) + decidim-meetings (= 0.27.4) + decidim-pages (= 0.27.4) + decidim-participatory_processes (= 0.27.4) + decidim-proposals (= 0.27.4) + decidim-sortitions (= 0.27.4) + decidim-surveys (= 0.27.4) + decidim-system (= 0.27.4) + decidim-templates (= 0.27.4) + decidim-verifications (= 0.27.4) + decidim-accountability (0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-admin (0.27.4) active_link_to (~> 1.0) - decidim-core (= 0.27.3) + decidim-core (= 0.27.4) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0) - decidim-api (0.27.3) + decidim-api (0.27.4) graphql (~> 1.12, < 1.13) graphql-docs (~> 2.1.0) rack-cors (~> 1.0) - decidim-assemblies (0.27.3) - decidim-core (= 0.27.3) - decidim-blogs (0.27.3) - decidim-admin (= 0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-budgets (0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-comments (0.27.3) - decidim-core (= 0.27.3) + decidim-assemblies (0.27.4) + decidim-core (= 0.27.4) + decidim-blogs (0.27.4) + decidim-admin (= 0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-budgets (0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-comments (0.27.4) + decidim-core (= 0.27.4) redcarpet (~> 3.5, >= 3.5.1) - decidim-consultations (0.27.3) - decidim-admin (= 0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-core (0.27.3) + decidim-consultations (0.27.4) + decidim-admin (= 0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-core (0.27.4) active_link_to (~> 1.0) acts_as_list (~> 0.9) batch-loader (~> 1.2) @@ -220,7 +218,7 @@ GEM cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) date_validator (~> 0.12.0) - decidim-api (= 0.27.3) + decidim-api (= 0.27.4) devise (~> 4.7) devise-i18n (~> 1.2) diffy (~> 3.3) @@ -233,7 +231,7 @@ GEM hashdiff (>= 0.4.0, < 2.0.0) invisible_captcha (~> 0.12) kaminari (~> 1.2, >= 1.2.1) - loofah (~> 2.3.1) + loofah (~> 2.19.0) mime-types (>= 1.16, < 4.0) mini_magick (~> 4.9) mustache (~> 1.1.0) @@ -261,15 +259,15 @@ GEM webpacker (= 6.0.0.rc.5) webpush (~> 1.1) wisper (~> 2.0) - decidim-debates (0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-dev (0.27.3) + decidim-debates (0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-dev (0.27.4) axe-core-rspec (~> 4.1.0) byebug (~> 11.0) capybara (~> 3.24) db-query-matchers (~> 0.10.0) - decidim (= 0.27.3) + decidim (= 0.27.4) erb_lint (~> 0.0.35) factory_bot_rails (~> 4.8) i18n-tasks (~> 0.9.18) @@ -292,45 +290,45 @@ GEM w3c_rspec_validators (~> 0.3.0) webmock (~> 3.6) wisper-rspec (~> 1.0) - decidim-forms (0.27.3) - decidim-core (= 0.27.3) + decidim-forms (0.27.4) + decidim-core (= 0.27.4) wicked_pdf (~> 2.1) wkhtmltopdf-binary (~> 0.12) - decidim-generators (0.27.3) - decidim-core (= 0.27.3) - decidim-meetings (0.27.3) - decidim-core (= 0.27.3) - decidim-forms (= 0.27.3) + decidim-generators (0.27.4) + decidim-core (= 0.27.4) + decidim-meetings (0.27.4) + decidim-core (= 0.27.4) + decidim-forms (= 0.27.4) icalendar (~> 2.5) - decidim-pages (0.27.3) - decidim-core (= 0.27.3) - decidim-participatory_processes (0.27.3) - decidim-core (= 0.27.3) - decidim-proposals (0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) + decidim-pages (0.27.4) + decidim-core (= 0.27.4) + decidim-participatory_processes (0.27.4) + decidim-core (= 0.27.4) + decidim-proposals (0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) doc2text (~> 0.4.5) redcarpet (~> 3.5, >= 3.5.1) - decidim-sortitions (0.27.3) - decidim-admin (= 0.27.3) - decidim-comments (= 0.27.3) - decidim-core (= 0.27.3) - decidim-proposals (= 0.27.3) - decidim-surveys (0.27.3) - decidim-core (= 0.27.3) - decidim-forms (= 0.27.3) - decidim-templates (= 0.27.3) - decidim-system (0.27.3) + decidim-sortitions (0.27.4) + decidim-admin (= 0.27.4) + decidim-comments (= 0.27.4) + decidim-core (= 0.27.4) + decidim-proposals (= 0.27.4) + decidim-surveys (0.27.4) + decidim-core (= 0.27.4) + decidim-forms (= 0.27.4) + decidim-templates (= 0.27.4) + decidim-system (0.27.4) active_link_to (~> 1.0) - decidim-core (= 0.27.3) + decidim-core (= 0.27.4) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0) - decidim-templates (0.27.3) - decidim-core (= 0.27.3) - decidim-forms (= 0.27.3) - decidim-verifications (0.27.3) - decidim-core (= 0.27.3) + decidim-templates (0.27.4) + decidim-core (= 0.27.4) + decidim-forms (= 0.27.4) + decidim-verifications (0.27.4) + decidim-core (= 0.27.4) declarative-builder (0.1.0) declarative-option (< 0.2.0) declarative-option (0.1.0) @@ -380,7 +378,7 @@ GEM railties (>= 3.0.0) faker (2.23.0) i18n (>= 1.8.11, < 2) - faraday (2.7.9) + faraday (2.7.10) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) @@ -402,7 +400,7 @@ GEM activesupport (>= 4.1, < 7.1) railties (>= 4.1, < 7.1) gemoji (3.0.1) - geocoder (1.8.1) + geocoder (1.8.2) globalid (1.1.0) activesupport (>= 5.0) graphql (1.12.24) @@ -474,7 +472,7 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.3.1) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.8.1) @@ -491,22 +489,21 @@ GEM mixlib-config (>= 2.2.1, < 4) mixlib-shellout method_source (1.0.0) - mime-types (3.4.1) + mime-types (3.5.0) mime-types-data (~> 3.2015) - mime-types-data (3.2023.0218.1) + mime-types-data (3.2023.0808) mini_magick (4.12.0) - mini_mime (1.1.2) - mini_portile2 (2.8.2) - minitest (5.18.1) + mini_mime (1.1.5) + minitest (5.19.0) mixlib-cli (2.1.8) mixlib-config (3.0.27) tomlrb mixlib-shellout (3.2.7) chef-utils - msgpack (1.7.1) + msgpack (1.7.2) multi_xml (0.6.0) mustache (1.1.1) - net-imap (0.3.6) + net-imap (0.3.7) date net-protocol net-pop (0.1.2) @@ -516,8 +513,7 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.14.5) - mini_portile2 (~> 2.8.0) + nokogiri (1.14.5-x86_64-linux) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -577,17 +573,17 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - public_suffix (5.0.1) + public_suffix (5.0.3) puma (5.6.6) nio4r (~> 2.0) racc (1.7.1) - rack (2.2.7) - rack-attack (6.6.1) - rack (>= 1.0, < 3) + rack (2.2.8) + rack-attack (6.7.0) + rack (>= 1.0, < 4) rack-cors (1.1.1) rack (>= 2.0.0) - rack-protection (3.0.6) - rack + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) rack-proxy (0.7.6) rack rack-test (2.1.0) @@ -611,12 +607,12 @@ GEM actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.1.1) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) @@ -643,7 +639,7 @@ GEM responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.5) + rexml (3.2.6) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -659,7 +655,7 @@ GEM rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.12.5) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (4.1.2) @@ -790,7 +786,7 @@ GEM webpush (1.1.0) hkdf (~> 0.2) jwt (~> 2.0) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) wicked_pdf (2.6.3) @@ -800,15 +796,14 @@ GEM wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.8) + zeitwerk (2.6.11) PLATFORMS - ruby + x86_64-linux DEPENDENCIES bootsnap (~> 1.4) byebug (~> 11.0) - codecov dalli (~> 2.7, >= 2.7.10) decidim (~> 0.27.0) decidim-consultations (~> 0.27.0) @@ -828,4 +823,4 @@ RUBY VERSION ruby 3.0.6p216 BUNDLED WITH - 2.4.12 + 2.2.33 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2b1bf65..0b80de0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,13 +2,6 @@ require "decidim/dev" -require "simplecov" -SimpleCov.start "rails" -if ENV["CODECOV"] - require "codecov" - SimpleCov.formatter = SimpleCov::Formatter::Codecov -end - ENV["ENGINE_ROOT"] = File.dirname(__dir__) Decidim::Dev.dummy_app_path =