1
- name : Ruby - Coverage
1
+ name : Test Coverage
2
+
3
+ permissions :
4
+ contents : read
5
+ pull-requests : write
6
+ id-token : write
2
7
3
8
env :
4
- K_SOUP_COV_MIN_BRANCH : 86
9
+ K_SOUP_COV_MIN_BRANCH : 85
5
10
K_SOUP_COV_MIN_LINE : 91
6
11
K_SOUP_COV_MIN_HARD : true
12
+ K_SOUP_COV_FORMATTERS : " html,xml,rcov,lcov,json,tty"
7
13
K_SOUP_COV_DO : true
8
- K_SOUP_COV_COMMAND_NAME : " MiniTest Coverage"
14
+ K_SOUP_COV_MULTI_FORMATTERS : true
15
+ K_SOUP_COV_COMMAND_NAME : " Test Coverage"
9
16
10
17
on :
11
18
push :
12
19
branches :
13
20
- ' main'
21
+ - ' *-stable'
14
22
tags :
15
23
- ' !*' # Do not execute on tags
16
24
pull_request :
19
27
# Allow manually triggering the workflow.
20
28
workflow_dispatch :
21
29
22
- permissions :
23
- contents : read
24
-
25
30
# Cancels all previous workflow runs for the same branch that have not yet completed.
26
31
concurrency :
27
32
# The concurrency group contains the workflow name and the branch name.
28
33
group : " ${{ github.workflow }}-${{ github.ref }}"
29
34
cancel-in-progress : true
30
35
31
36
jobs :
32
- test :
33
- name : Specs with Coverage - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
34
- if : " !contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
35
- env : # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
36
- BUNDLE_GEMFILE : ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
37
+ coverage :
38
+ name : Code Coverage on ${{ matrix.ruby }}@current
39
+ if : ${{!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')}}
37
40
runs-on : ubuntu-latest
41
+ continue-on-error : ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
42
+ env : # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps
43
+ BUNDLE_GEMFILE : ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile
38
44
strategy :
45
+ fail-fast : false
39
46
matrix :
40
- rubygems :
41
- - latest
42
- bundler :
43
- - latest
44
- gemfile :
45
- - coverage
46
- ruby :
47
- - ' 3.1 '
47
+ include :
48
+ # Coverage
49
+ - ruby : " ruby "
50
+ appraisal : " coverage "
51
+ exec_cmd : " rake test "
52
+ gemfile : " Appraisal.root "
53
+ rubygems : latest
54
+ bundler : latest
48
55
49
56
steps :
50
57
- name : Checkout
@@ -56,14 +63,38 @@ jobs:
56
63
ruby-version : " ${{ matrix.ruby }}"
57
64
rubygems : " ${{ matrix.rubygems }}"
58
65
bundler : " ${{ matrix.bundler }}"
59
- bundler-cache : true # runs 'bundle install' and caches installed gems automatically
66
+ bundler-cache : true
60
67
61
- - name : Run tests
62
- run : bundle exec rake test
68
+ # Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root)
69
+ # We need to do this first to get appraisal installed.
70
+ # NOTE: This does not use the primary Gemfile at all.
71
+ # - name: Install Root Appraisal
72
+ # run: bundle
73
+ - name : Appraisal for ${{ matrix.appraisal }}
74
+ run : bundle exec appraisal ${{ matrix.appraisal }} bundle
75
+ - name : Tests for ${{ matrix.ruby }}@current via ${{ matrix.exec_cmd }}
76
+ run : bundle exec appraisal ${{ matrix.appraisal }} bundle exec ${{ matrix.exec_cmd }}
77
+
78
+ # Do SaaS coverage uploads first
79
+ - name : Upload coverage to Coveralls
80
+ if : ${{ !env.ACT }}
81
+ uses : coverallsapp/github-action@master
82
+ with :
83
+ github-token : ${{ secrets.GITHUB_TOKEN }}
84
+ continue-on-error : ${{ matrix.experimental != 'false' }}
85
+
86
+ - name : Upload coverage to QLTY
87
+ if : ${{ !env.ACT }}
88
+ uses : qltysh/qlty-action/coverage@main
89
+ with :
90
+ token : ${{secrets.QLTY_COVERAGE_TOKEN}}
91
+ files : coverage/.resultset.json
92
+ continue-on-error : ${{ matrix.experimental != 'false' }}
63
93
94
+ # Then PR comments
64
95
- name : Code Coverage Summary Report
96
+ if : ${{ !env.ACT && github.event_name == 'pull_request' }}
65
97
66
- if : ${{ github.event_name == 'pull_request' }}
67
98
with :
68
99
filename : ./coverage/coverage.xml
69
100
badge : true
@@ -73,12 +104,12 @@ jobs:
73
104
hide_complexity : true
74
105
indicators : true
75
106
output : both
76
- thresholds : ' 91 86 '
107
+ thresholds : ' 91 85 '
77
108
continue-on-error : ${{ matrix.experimental != 'false' }}
78
109
79
110
- name : Add Coverage PR Comment
80
111
uses : marocchino/sticky-pull-request-comment@v2
81
- if : ${{ github.event_name == 'pull_request' }}
112
+ if : ${{ !env.ACT && github.event_name == 'pull_request' }}
82
113
with :
83
114
recreate : true
84
115
path : code-coverage-results.md
0 commit comments