Skip to content

Commit

Permalink
Add test coverage report to Codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt committed Aug 24, 2024
1 parent 347eb6f commit e4656ae
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,45 @@ jobs:
- name: Lint
run: npm run lint

coverage:
name: Report coverage
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
cache: npm
node-version: 20

- name: Install dependencies
run: npm ci
env:
npm_config_debug: true

- name: Run tests
run: node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info test.cjs

- name: Install lcov
run: sudo apt install -yq lcov

- name: Merge coverage reports
run: |
lcov --capture --directory . --no-external --output-file lcov-cpp.info
lcov --add-tracefile lcov-cpp.info --add-tracefile lcov.info --output-file lcov.info
lcov --remove lcov.info "*/node_modules/*" --output-file lcov.info
- name: "Send to Codacy"
uses: codacy/codacy-coverage-reporter-action@v1
with:
coverage-reports: lcov.info
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}

test:
strategy:
matrix:
Expand Down

0 comments on commit e4656ae

Please sign in to comment.