Skip to content

Commit 06359c6

Browse files
committed
ci: add codecov github action
1 parent 2f22724 commit 06359c6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/codecov.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test-and-coverage:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Run tests with coverage
28+
run: npm test -- --coverage
29+
30+
- name: Upload coverage to Codecov
31+
uses: codecov/codecov-action@v5.1.2
32+
with:
33+
token: ${{ secrets.CODECOV_TOKEN }} # Set in GitHub repository secrets
34+
files: ./coverage/lcov.info # Adjust path if necessary
35+
flags: unittests # Optional flags for tracking different types of tests
36+
name: codecov-coverage-report # Optional, useful for identifying reports
37+
fail_ci_if_error: true # Fails CI if Codecov upload fails

0 commit comments

Comments
 (0)