Skip to content

Commit c8a92b1

Browse files
committed
fix(CI): Upload coverage to Codecov
1 parent cf07602 commit c8a92b1

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

.DS_Store

-6 KB
Binary file not shown.

.github/workflows/main.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313

1414
env:
1515
ACTIONVIEW_VERSION: ${{ matrix.actionview_version }}
16+
COVERAGE: true
1617

1718
steps:
1819
- uses: actions/checkout@v4
@@ -25,6 +26,12 @@ jobs:
2526
bundler-cache: true
2627
continue-on-error: ${{ matrix.ruby_version == 'ruby-head' }}
2728

28-
- name: Run the default task
29+
- name: Run tests and collect coverage
2930
run: bundle exec rake
3031
continue-on-error: ${{ matrix.ruby_version == 'ruby-head' }}
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v5
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
if: ${{ matrix.ruby_version == '3.3' && matrix.actionview_version == '7.1' }}

.simplecov

-5
This file was deleted.

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ gem "rubocop-minitest", require: false
2222
gem "rubocop-rake", require: false
2323

2424
gem "simplecov", "~> 0.22.0", require: false
25+
gem "simplecov-cobertura", "~> 2.1", require: false

Gemfile.lock

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ GEM
8686
rainbow (3.1.1)
8787
rake (13.2.1)
8888
regexp_parser (2.10.0)
89+
rexml (3.4.0)
8990
rubocop (1.71.2)
9091
json (~> 2.3)
9192
language_server-protocol (>= 3.17.0)
@@ -109,6 +110,9 @@ GEM
109110
docile (~> 1.1)
110111
simplecov-html (~> 0.11)
111112
simplecov_json_formatter (~> 0.1)
113+
simplecov-cobertura (2.1.0)
114+
rexml
115+
simplecov (~> 0.19)
112116
simplecov-html (0.13.1)
113117
simplecov_json_formatter (0.1.4)
114118
tzinfo (2.0.6)
@@ -133,6 +137,7 @@ DEPENDENCIES
133137
rubocop-minitest
134138
rubocop-rake
135139
simplecov (~> 0.22.0)
140+
simplecov-cobertura (~> 2.1)
136141

137142
BUNDLED WITH
138143
2.6.3

test/test_helper.rb

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# frozen_string_literal: true
22

3-
require "simplecov"
3+
require "logger"
4+
5+
if ENV["COVERAGE"]
6+
require "simplecov"
7+
SimpleCov.start do
8+
enable_coverage :branch
9+
add_filter "/test/"
10+
end
11+
end
12+
13+
if ENV["CI"]
14+
require "simplecov-cobertura"
15+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
16+
end
417

518
require "minitest/autorun"
619
require "cva_rails"

0 commit comments

Comments
 (0)