From 8ecd98fca41f569a6d103f4398bc9cfc7d2f4f23 Mon Sep 17 00:00:00 2001 From: Kaustubh Nair Date: Thu, 2 Jan 2020 22:48:58 +0530 Subject: [PATCH] Remove coveralls, add codecov (#5954) * Remove coveralls, add codecov * Add env variable * Comment reporting lines * Change env variable * Remove coveralls from rake file * Fix travis and rakefile * Remove project for codecov * Remove old reports before running * typo replace omment with comment (#7042) * typo replace omment with comment * Update blog.css * Update .travis.yml * Update .travis.yml * add codecov branch to travis for debugging Co-authored-by: Uzay-G <52892257+Uzay-G@users.noreply.github.com> Co-authored-by: Jeffrey Warren --- .codecov.yml | 11 +++++++++++ .simplecov | 22 ++++++++++++++++++++++ .travis.yml | 8 ++++---- Gemfile | 3 ++- Gemfile.lock | 17 +++++++---------- Rakefile | 3 --- app/assets/stylesheets/blog.css | 2 +- test/test_helper.rb | 4 +--- 8 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 .codecov.yml create mode 100644 .simplecov diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000000..6875bfe0aaf --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,11 @@ +comment: + layout: "reach, diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes + require_base: no # [yes :: must have a base report to post] + require_head: yes # [yes :: must have a head report to post] + branches: null # branch names that can post comment +coverage: + status: + project: on + patch: on diff --git a/.simplecov b/.simplecov new file mode 100644 index 00000000000..076d3d79b2d --- /dev/null +++ b/.simplecov @@ -0,0 +1,22 @@ +SimpleCov.start + +if ENV['CI'] == 'true' + require 'codecov' + SimpleCov.formatter = SimpleCov::Formatter::Codecov +else + SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter +end + +SimpleCov.start 'rails' do + add_group 'Units', 'app/models' + add_group 'Functionals', 'app/controllers' + add_group 'Services', 'app/services' + add_group 'Libraries', 'lib/' + + add_filter '/test/' + add_filter '/config/' + add_filter '/db/' + add_filter '/vendor/' + add_filter '/log/' + add_filter '/tmp/' +end diff --git a/.travis.yml b/.travis.yml index c4330545ae4..cecdf03f3b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ git: env: global: - COMPOSE_FILE=./containers/docker-compose-testing.yml + - CI=true matrix: - TASK="rake test:all" - TASK="rails test test/unit" @@ -18,15 +19,14 @@ env: - TASK="rails test test/integration" - TASK="rails test:system" -before_install: - - echo -e "repo_token:\n $COVERALLS_REPO_TOKEN" >> ./.coveralls.yml - branches: only: - master - unstable + - codecov install: + - rm -rf test/reports - cp config/database.yml.example config/database.yml - cp db/schema.rb.example db/schema.rb - docker-compose build @@ -40,7 +40,7 @@ install: script: - docker-compose exec web bash -c 'echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" > /tmp/credentials.json' # needs to be a path to a json file, so we shuffle... - - docker-compose exec web bash -c "CI=TRUE GENERATE_REPORT=true $TASK" + - docker-compose exec web bash -c "GENERATE_REPORT=true $TASK" - if [ $TASK != "rake test:all" ]; then echo -e '' > output.xml; tail -n +2 -q ./test/reports/TEST*.xml >> output.xml; diff --git a/Gemfile b/Gemfile index 311c142e12f..3575646313c 100644 --- a/Gemfile +++ b/Gemfile @@ -102,7 +102,8 @@ end group :test, :development do gem 'capybara' gem 'ci_reporter_test_unit' - gem 'coveralls', require: false + gem 'simplecov', require: false + gem 'codecov', require: false gem 'jasmine-jquery-rails' gem 'jasmine-rails' gem 'json_expressions' diff --git a/Gemfile.lock b/Gemfile.lock index 5925a958f9d..b2c824171a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,6 +86,10 @@ GEM ci_reporter (~> 2.0) test-unit (>= 2.5.5, < 4.0) climate_control (0.2.0) + codecov (0.1.14) + json + simplecov + url coderay (1.1.2) coercible (1.0.0) descendants_tracker (~> 0.0.1) @@ -101,12 +105,6 @@ GEM activerecord (~> 5.2.1) concurrent-ruby (1.1.5) connection_pool (2.2.2) - coveralls (0.8.23) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (>= 0.19.4, < 2.0) - tins (~> 1.6) crass (1.0.5) declarative (0.0.10) declarative-option (0.1.0) @@ -495,8 +493,6 @@ GEM railties (>= 3.2.5, < 6) teaspoon-mocha (2.3.3) teaspoon (>= 1.0.0) - term-ansicolor (1.7.1) - tins (~> 1.0) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) test-unit (3.3.4) @@ -508,7 +504,6 @@ GEM thread_safe (0.3.6) tilt (2.0.9) timecop (0.9.1) - tins (1.20.2) turbolinks (5.2.0) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) @@ -533,6 +528,7 @@ GEM unf_ext (0.0.7.6) unicode-display_width (1.6.0) unicode-emoji (2.3.1) + url (0.3.2) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -565,9 +561,9 @@ DEPENDENCIES byebug capybara ci_reporter_test_unit + codecov coffee-rails (~> 5.0.0) composite_primary_keys - coveralls execjs figaro friendly_id @@ -640,6 +636,7 @@ DEPENDENCIES selenium-webdriver (~> 3.142.6) sentry-raven sidekiq + simplecov skylight sqlite3 (~> 1.3.6) teaspoon-mocha diff --git a/Rakefile b/Rakefile index 6837e41217c..07bb8777789 100644 --- a/Rakefile +++ b/Rakefile @@ -20,14 +20,11 @@ namespace :test do desc "Run rails and teaspoon tests" task :all => :environment do - require 'coveralls/rake/task' - Coveralls::RakeTask.new if ENV['GENERATE_REPORT'] == 'true' require 'ci/reporter/rake/test_unit' Rake::Task["ci:setup:testunit"].execute end puts "Running teaspoon tests headlessly" Rake::Task["teaspoon"].execute - Rake::Task["coveralls:push"].execute end end diff --git a/app/assets/stylesheets/blog.css b/app/assets/stylesheets/blog.css index 453aaa4619d..64c3267d366 100644 --- a/app/assets/stylesheets/blog.css +++ b/app/assets/stylesheets/blog.css @@ -2,7 +2,7 @@ font-size:4em; margin-top:100px; color:#326; - line-height:1.3em; + line-height:1.3em } .blog h1 { diff --git a/test/test_helper.rb b/test/test_helper.rb index 98dd217812d..9f8ce5d7654 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,4 @@ -require 'coveralls' -Coveralls.wear! - +require 'simplecov' ENV['RAILS_ENV'] = 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help'