Skip to content

Commit

Permalink
(CAT-1618) - Add code coverage to gem_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Jan 15, 2024
1 parent 001f624 commit 9e3a49f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- "main"
workflow_dispatch:

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:

spec:
Expand All @@ -19,6 +22,7 @@ jobs:
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
secrets: "inherit"
with:
rake_task: 'spec:coverage'
ruby_version: ${{ matrix.ruby_version }}

acceptance:
Expand Down
8 changes: 6 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
if ENV.fetch('COVERAGE', nil) == 'yes'
require 'codecov'
require 'simplecov'
require 'simplecov-console'

SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console,
SimpleCov::Formatter::Codecov
]

if ENV['CI'] == 'true'
require 'codecov'
SimpleCov.formatters << SimpleCov::Formatter::Codecov
end

SimpleCov.start do
track_files 'lib/**/*.rb'

Expand Down

0 comments on commit 9e3a49f

Please sign in to comment.