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