Merge pull request #10363 from colinux/simplecov

Tech: active le code coverage avec simplecov & codecov
This commit is contained in:
Colin Darie 2024-04-22 14:08:02 +00:00 committed by GitHub
commit c1d6c94df7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 62 additions and 0 deletions

View file

@ -51,6 +51,11 @@ jobs:
run: |
bun run test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
unit_tests:
name: Unit tests
runs-on: ubuntu-latest
@ -100,6 +105,11 @@ jobs:
name: rspec-results-${{ github.job }}-${{ strategy.job-index }}
path: tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
system_tests:
name: System tests
runs-on: ubuntu-latest
@ -144,6 +154,11 @@ jobs:
name: rspec-results-${{ github.job }}-${{ strategy.job-index }}
path: tmp/rspec_${{ github.job }}_${{ strategy.job-index }}.junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
save_test_reports:
name: Save test reports
needs: [unit_tests, system_tests]

1
.gitignore vendored
View file

@ -29,6 +29,7 @@ yarn-debug.log*
/public/assets
/spec/support/spec_config.local.rb
/config/initializers/config.local.rb
/coverage
# Local Netlify folder
.netlify

28
.simplecov Normal file
View file

@ -0,0 +1,28 @@
# frozen_string_literal: true
SimpleCov.start "rails" do
enable_coverage :branch
command_name "RSpec process #{Process.pid}"
if ENV["CI"] # codecov compatibility
require 'simplecov-cobertura'
formatter SimpleCov::Formatter::CoberturaFormatter
else
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::SimpleFormatter,
SimpleCov::Formatter::HTMLFormatter
])
end
add_filter "/channels/" # not used
groups.delete("Channels")
add_group "Components", "app/components"
add_group "API", ["app/graphql", "app/serializers"]
add_group "Manager", ["app/dashboards", "app/fields"]
add_group "Models", ["app/models", "app/validators"]
add_group "Policies", "app/policies"
add_group "Services", "app/services"
add_group "Tasks", ["app/tasks", "lib/tasks"]
end

View file

@ -125,6 +125,8 @@ group :test do
gem 'selenium-devtools'
gem 'selenium-webdriver'
gem 'shoulda-matchers', require: false
gem 'simplecov', require: false
gem 'simplecov-cobertura', require: false
gem 'timecop'
gem 'vcr'
gem 'webmock'

View file

@ -223,6 +223,7 @@ GEM
diff-lcs (1.5.1)
discard (1.3.0)
activerecord (>= 4.2, < 8)
docile (1.4.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
@ -728,6 +729,15 @@ GEM
simple_xlsx_reader (1.0.4)
nokogiri
rubyzip
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
simpleidn (0.2.1)
unf (~> 0.1.4)
sinatra (3.2.0)
@ -991,6 +1001,8 @@ DEPENDENCIES
sidekiq
sidekiq-cron
simple_xlsx_reader
simplecov
simplecov-cobertura
skylight
spreadsheet_architect
spring

View file

@ -16,6 +16,10 @@
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
#
#
require 'simplecov' # see config in .simplecov file
require 'rspec/retry'
SECURE_PASSWORD = 'my-s3cure-p4ssword'