diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2523d7d42..cd38d3c590 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ on: env: DISABLE_KNAPSACK: true TIMEZONE: UTC + COVERAGE: true jobs: test-controllers-and-serializers: @@ -51,6 +52,9 @@ jobs: - name: Run controller tests run: bundle exec rspec --profile -- spec/controllers spec/serializers + - name: Codecov + uses: codecov/codecov-action@v1.3.1 + test-models: runs-on: ubuntu-18.04 services: @@ -92,6 +96,9 @@ jobs: - name: Run tests run: bundle exec rspec --profile -- spec/models + - name: Codecov + uses: codecov/codecov-action@v1.3.1 + test-admin-features-1: runs-on: ubuntu-18.04 services: @@ -133,6 +140,9 @@ jobs: - name: Run admin feature tests run: bundle exec rspec --profile -- spec/features/admin/[a-o0-9]*_spec.rb + - name: Codecov + uses: codecov/codecov-action@v1.3.1 + test-admin-features-2: runs-on: ubuntu-18.04 services: @@ -174,6 +184,9 @@ jobs: - name: Run admin feature tests run: bundle exec rspec --profile -- spec/features/admin/[p-z]*_spec.rb + - name: Codecov + uses: codecov/codecov-action@v1.3.1 + test-consumer-features: runs-on: ubuntu-18.04 services: @@ -215,6 +228,9 @@ jobs: - name: Run consumer feature tests run: bundle exec rspec --profile -- spec/features/consumer + - name: Codecov + uses: codecov/codecov-action@v1.3.1 + test-engines-etc: runs-on: ubuntu-18.04 services: @@ -299,3 +315,6 @@ jobs: - name: Run admin feature folders, engines, lib run: bundle exec rspec --profile --pattern "engines/*/spec/{,/*/**}/*_spec.rb,spec/features/admin/*/*_spec.rb,spec/lib/{,/*/**}/*_spec.rb" + + - name: Codecov + uses: codecov/codecov-action@v1.3.1 diff --git a/.simplecov b/.simplecov index ed6f826b48..e1ed14aec0 100644 --- a/.simplecov +++ b/.simplecov @@ -1,8 +1,6 @@ #!/bin/env ruby SimpleCov.start 'rails' do - minimum_coverage 54 - add_filter '/bin/' add_filter '/config/' add_filter '/jobs/application_job.rb' @@ -16,3 +14,6 @@ SimpleCov.start 'rails' do add_filter '/log' add_filter '/db' end + +require 'codecov' +SimpleCov.formatter = SimpleCov::Formatter::Codecov diff --git a/Gemfile b/Gemfile index a529d9c0ed..0b69e23018 100644 --- a/Gemfile +++ b/Gemfile @@ -141,6 +141,7 @@ group :test, :development do end group :test do + gem 'codecov', require: false gem 'simplecov', require: false gem 'test-prof' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index 46d4641806..3c8321a5f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -152,6 +152,8 @@ GEM climate_control (0.2.0) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) + codecov (0.5.1) + simplecov (>= 0.15, < 0.22) coderay (1.1.3) coffee-rails (4.2.2) coffee-script (>= 2.2.0) @@ -618,6 +620,7 @@ DEPENDENCIES cancancan (~> 1.15.0) capybara catalog! + codecov coffee-rails (~> 4.2.2) combine_pdf compass-rails diff --git a/README.md b/README.md index 0f84dc3968..605e79b00d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Build](https://github.com/openfoodfoundation/openfoodnetwork/actions/workflows/build.yml/badge.svg)](https://github.com/openfoodfoundation/openfoodnetwork/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/openfoodfoundation/openfoodnetwork/branch/master/graph/badge.svg?token=FBSOod4qiu)](https://codecov.io/gh/openfoodfoundation/openfoodnetwork) [![Code Climate](https://codeclimate.com/github/openfoodfoundation/openfoodnetwork.png)](https://codeclimate.com/github/openfoodfoundation/openfoodnetwork) # Open Food Network