File tree 5 files changed +23
-6
lines changed
5 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 6
6
- " main"
7
7
workflow_dispatch :
8
8
9
+ env :
10
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
11
+
9
12
jobs :
10
13
spec :
11
14
strategy :
@@ -18,14 +21,15 @@ jobs:
18
21
- ruby-version : ' 2.7'
19
22
puppet_gem_version : ' ~> 7.0'
20
23
- ruby_version : ' 3.2'
21
- puppet_gem_version : ' https://github.com/puppetlabs/puppet ' # puppet8 '
24
+ puppet_gem_version : ' ~> 8.0 '
22
25
runs_on :
23
26
- " ubuntu-latest"
24
27
- " windows-latest"
25
28
name : " spec (${{ matrix.runs_on }} ruby ${{ matrix.ruby_version }} | puppet ${{matrix.puppet_gem_version}})"
26
29
uses : " puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
27
30
secrets : " inherit"
28
31
with :
32
+ rake_task : " spec:coverage"
29
33
ruby_version : ${{ matrix.ruby_version }}
30
34
puppet_gem_version : ${{ matrix.puppet_gem_version }}
31
35
runs_on : ${{ matrix.runs_on }}
Original file line number Diff line number Diff line change 17
17
- ruby-version : ' 2.7'
18
18
puppet_gem_version : ' ~> 7.0'
19
19
- ruby_version : ' 3.2'
20
- puppet_gem_version : ' https://github.com/puppetlabs/puppet ' # puppet8 '
20
+ puppet_gem_version : ' ~> 8.0 '
21
21
runs_on :
22
22
- " ubuntu-latest"
23
23
- " windows-latest"
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ group :development do
43
43
gem 'serverspec'
44
44
gem 'simplecov' , require : false
45
45
gem 'simplecov-console' , require : false
46
+ gem 'codecov' , require : false
46
47
47
48
gem 'redcarpet'
48
49
end
Original file line number Diff line number Diff line change @@ -15,6 +15,15 @@ RSpec::Core::RakeTask.new(:spec) do |t|
15
15
t . exclude_pattern = "spec/acceptance/**/*.rb"
16
16
end
17
17
18
+ namespace :spec do
19
+ desc 'Run RSpec code examples with coverage collection'
20
+ task :coverage do
21
+ ENV [ 'COVERAGE' ] = 'yes'
22
+ Rake ::Task [ 'spec' ] . execute
23
+ end
24
+ end
25
+
26
+
18
27
RSpec ::Core ::RakeTask . new ( :acceptance ) do |t |
19
28
t . pattern = "spec/unit/**/*.rb"
20
29
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
if ENV [ 'COVERAGE' ] == 'yes'
4
- require 'codecov'
5
4
require 'simplecov'
6
5
require 'simplecov-console'
7
6
8
7
SimpleCov . formatters = [
9
8
SimpleCov ::Formatter ::HTMLFormatter ,
10
- SimpleCov ::Formatter ::Console ,
11
- SimpleCov ::Formatter ::Codecov
9
+ SimpleCov ::Formatter ::Console
12
10
]
13
11
12
+ if ENV [ 'CI' ] == 'true'
13
+ require 'codecov'
14
+ SimpleCov . formatters << SimpleCov ::Formatter ::Codecov
15
+ end
16
+
14
17
SimpleCov . start do
15
18
track_files 'lib/**/*.rb'
16
-
19
+ add_filter 'lib/puppet-strings/version.rb'
17
20
add_filter '/spec'
18
21
end
19
22
end
You can’t perform that action at this time.
0 commit comments