feat: setup test coverage #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test Zolt | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
name: With Node.js ${{ matrix.node-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- 20 | |
- 18 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build the project | |
run: pnpm run build | |
- name: Run tests with coverage | |
run: pnpm run test:coverage | |
- name: Merge coverage reports | |
run: pnpm exec c8 report --reporter=json | |
- name: Send coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage/coverage-final.json | |
flags: unittests | |
fail_ci_if_error: true |