diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..dbdf838 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,41 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "50...100" + + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: auto + threshold: 1% + +# Ignore files/directories that tests won't cover +ignore: + - "tests/**" # Test files + - "**/*.test.ts" # Test files + - "**/*.spec.ts" # Test files + - "lib/**" # Compiled output + - "coverage/**" # Coverage reports + - "node_modules/**" # Dependencies + +# Carry forward coverage from previous successful uploads when a flag's +# report is missing (e.g. a CI test suite failed and skipped uploading). +# This prevents patch coverage from dropping drastically due to incomplete data. +flag_management: + default_rules: + carryforward: true + +flags: + unit-tests: + carryforward: true + +comment: + layout: "reach,diff,flags,files" + behavior: default diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 6cfd421..d439faf 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -10,6 +10,9 @@ name: PR Checks on: + push: + branches: + - main pull_request: branches: - main @@ -32,6 +35,9 @@ jobs: unit-tests: runs-on: ubuntu-22.04 + permissions: + contents: read + id-token: write steps: - name: Checkout uses: actions/checkout@v3 @@ -50,3 +56,10 @@ jobs: run: yarn lint - name: Run unit tests run: yarn test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v6 + with: + use_oidc: true + flags: unit-tests + files: coverage/lcov.info + fail_ci_if_error: false