Skip to content

Commit ec6824b

Browse files
ptomanRHclaude
andauthored
feat: add Codecov integration for unit test coverage (#543)
* feat: add Codecov integration for unit test coverage - Add lcov reporter to c8 config for Codecov-compatible output - Add Codecov upload step to test workflow with OIDC auth - Add permissions: id-token: write for OIDC token - Add codecov.yml with informational status checks and unit-tests flag Ref: COVERPORT-254 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove hardcoded Codecov slug Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b68592e commit ec6824b

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
test:
1919
runs-on: ubuntu-latest
2020
name: Lint and test project
21+
permissions:
22+
id-token: write
2123
strategy:
2224
matrix:
2325
node: ['22', '24']
@@ -111,3 +113,11 @@ jobs:
111113
name: coverage
112114
path: ./coverage/coverage-final.json
113115

116+
- name: Upload coverage to Codecov
117+
if: ${{ matrix.node == env.MAIN_NODE_VER }}
118+
uses: codecov/codecov-action@v5
119+
with:
120+
use_oidc: true
121+
flags: unit-tests
122+
files: ./coverage/lcov.info
123+

codecov.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 1%
7+
informational: true
8+
patch:
9+
default:
10+
target: auto
11+
threshold: 1%
12+
informational: true
13+
14+
ignore:
15+
- "node_modules/**"
16+
- "dist/**"
17+
- "coverage/**"
18+
19+
flags:
20+
unit-tests:
21+
carryforward: true
22+
23+
comment:
24+
layout: "reach,diff,flags,files"
25+
behavior: default

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"reporter": [
114114
"html",
115115
"json",
116+
"lcov",
116117
"text"
117118
]
118119
},

0 commit comments

Comments
 (0)