add usage to readme #94
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| # step 1: run tests and generate a coverage report (but don't fail on thresholds here) | |
| test-and-report: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run tests and generate coverage | |
| # override thresholds to 0 here so this job always passes if logic is correct | |
| run: pnpm jest --ci --coverage --coverageThreshold='{}' | |
| continue-on-error: true | |
| - name: Upload coverage summary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-data | |
| path: coverage/coverage-summary.json | |
| retention-days: 14 | |
| - name: Upload coverage HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: coverage/lcov-report/ | |
| retention-days: 14 | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| # step 2: check coverage thresholds as a separate job | |
| check-thresholds: | |
| needs: test-and-report | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download coverage summary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage-data | |
| - name: Run Audit Script | |
| run: node bin/check_coverage_thresholds.js | |
| # step 3: run mutation testing only if initial tests passed (in parallel to threshold check) | |
| mutation-testing: | |
| needs: test-and-report | |
| if: success() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Stryker | |
| run: npx stryker run | |
| - name: Run Mutation Audit | |
| run: node bin/check_no_survived_mutants.js | |
| - name: Upload Stryker Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stryker-mutation-report | |
| path: reports/stryker/ |