Skip to content

Commit c3b28d4

Browse files
committed
Integrate with codecov
Third-party code coverage analysis: https://docs.codecov.com/docs/quick-start Settings for Joy of Rails: https://app.codecov.io/gh/joyofrails/joyofrails.com/new Setup included adding the Codecov GitHub app through the GitHub UI and adding the CODECOV_TOKEN repository secret (obtained from the Joy of Rails settings page in Codecov).
1 parent 8b7736e commit c3b28d4

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

.github/workflows/verify.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ jobs:
9292
RAILS_ENV: test
9393
run: bin/rspec
9494

95+
- name: Upload coverage reports to Codecov
96+
uses: codecov/[email protected]
97+
with:
98+
token: ${{ secrets.CODECOV_TOKEN }}
99+
95100
setup:
96101
name: Setup
97102
runs-on: ubuntu-latest
@@ -164,6 +169,11 @@ jobs:
164169
run: |
165170
npm run test -- --watch=false
166171
172+
- name: Upload coverage reports to Codecov
173+
uses: codecov/[email protected]
174+
with:
175+
token: ${{ secrets.CODECOV_TOKEN }}
176+
167177
assets:
168178
name: Assets
169179
runs-on: ubuntu-latest

.simplecov

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# frozen_string_literal: true
22

3-
require "simplecov-tailwindcss"
4-
5-
SimpleCov.formatter = SimpleCov::Formatter::TailwindFormatter
3+
if ENV["CI"]
4+
require "simplecov-cobertura"
5+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
6+
else
7+
require "simplecov-tailwindcss"
8+
SimpleCov.formatter = SimpleCov::Formatter::TailwindFormatter
9+
end
610

711
SimpleCov.profiles.define :joyofrails do
812
load_profile "test_frameworks"

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ group :test do
5858
gem "selenium-webdriver" # Ruby bindings for Selenium [https://www.rubydoc.info/gems/selenium-webdriver/frames]
5959
gem "cuprite", git: "https://github.com/rubycdp/cuprite"
6060
gem "simplecov", require: false # Code coverage for Ruby [https://github.com/simplecov-ruby/simplecov]
61-
gem "simplecov-tailwindcss", require: false
61+
gem "simplecov-tailwindcss", require: false # Alternative HTML formatter for SimpleCov [https://github.com/chiefpansancolt/simplecov-tailwindcss]
62+
gem "simplecov-cobertura", require: false # Produces Cobertura formatted XML from SimpleCov. [https://github.com/dashingrocket/simplecov-cobertura]
6263
gem "webmock", require: false # Library for stubbing HTTP requests [https://github.com/bblimke/webmock]
6364
end
6465

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ GEM
437437
docile (~> 1.1)
438438
simplecov-html (~> 0.11)
439439
simplecov_json_formatter (~> 0.1)
440+
simplecov-cobertura (2.1.0)
441+
rexml
442+
simplecov (~> 0.19)
440443
simplecov-html (0.12.3)
441444
simplecov-tailwindcss (2.2.0)
442445
simplecov (~> 0.16)
@@ -574,6 +577,7 @@ DEPENDENCIES
574577
ruby_wasm (~> 2.5)
575578
selenium-webdriver
576579
simplecov
580+
simplecov-cobertura
577581
simplecov-tailwindcss
578582
sitepress-rails
579583
solid_cache

0 commit comments

Comments
 (0)