Applies code to avoid conflicts between code coverage reports

...generated by parallel CI nodes, according to documentation here: https://docs.knapsackpro.com/ruby/simplecov/

Sets upload-artifact code on build file - for controllers
This commit is contained in:
filipefurtad0
2024-07-18 19:25:36 +01:00
parent 146296d0b2
commit 2d51e0f49e
2 changed files with 18 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ jobs:
POSTGRES_DB: open_food_network_test
POSTGRES_USER: ofn
POSTGRES_PASSWORD: f00d
strategy:
fail-fast: false
matrix:
@@ -86,6 +87,15 @@ jobs:
git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3)
bin/rake knapsack_pro:rspec
- name: Save SimpleCov file
uses: actions/upload-artifact@v3
with:
name: simple-cov-output-files
path: coverage/*.*
retention-days: 7
if-no-files-found: ignore
models:
runs-on: ubuntu-22.04
services:
@@ -484,4 +494,4 @@ jobs:
run: bin/rake karma:run
- name: Run jest tests
run: yarn jest
run: yarn jest

View File

@@ -2,9 +2,11 @@
# This file defines configurations that are universal to all spec types (feature, system, etc)
require 'simplecov' # if ENV["COVERAGE"]
SimpleCov.start
ENV["RAILS_ENV"] ||= 'test'
require 'simplecov' if ENV["COVERAGE"]
require 'rubygems'
require 'pry' unless ENV['CI']
require 'view_component/test_helpers'
@@ -27,6 +29,10 @@ end
require 'knapsack_pro'
KnapsackPro::Adapters::RSpecAdapter.bind
KnapsackPro::Hooks::Queue.before_queue do
SimpleCov.command_name("rspec_ci_node_#{KnapsackPro::Config::Env.ci_node_index}")
end
# Allow connections to selenium whilst raising errors when connecting to external sites
require 'webmock/rspec'
WebMock.enable!