Skip to content

Commit e4656ae

Browse files
committed
Add test coverage report to Codacy
1 parent 347eb6f commit e4656ae

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,45 @@ jobs:
1919
- name: Lint
2020
run: npm run lint
2121

22+
coverage:
23+
name: Report coverage
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
submodules: true
31+
32+
- name: Use Node.js 20
33+
uses: actions/setup-node@v4
34+
with:
35+
cache: npm
36+
node-version: 20
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
env:
41+
npm_config_debug: true
42+
43+
- name: Run tests
44+
run: node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info test.cjs
45+
46+
- name: Install lcov
47+
run: sudo apt install -yq lcov
48+
49+
- name: Merge coverage reports
50+
run: |
51+
lcov --capture --directory . --no-external --output-file lcov-cpp.info
52+
lcov --add-tracefile lcov-cpp.info --add-tracefile lcov.info --output-file lcov.info
53+
lcov --remove lcov.info "*/node_modules/*" --output-file lcov.info
54+
55+
- name: "Send to Codacy"
56+
uses: codacy/codacy-coverage-reporter-action@v1
57+
with:
58+
coverage-reports: lcov.info
59+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
60+
2261
test:
2362
strategy:
2463
matrix:

0 commit comments

Comments
 (0)