From 17323cef0e4dba4427d60c6d31d74f0835f9106f Mon Sep 17 00:00:00 2001 From: Mykhailo Kuznietsov Date: Mon, 26 Oct 2026 15:27:45 +0200 Subject: [PATCH] chore: add codecov coverage tracking - Add Codecov upload step to unit-tests workflow with OIDC auth - Configure workflow to run on push to main (establishes baseline) - Add .codecov.yml with ignore patterns and flag configuration - Use unit-tests flag to categorize coverage uploads Co-Authored-By: Claude Sonnet 4.5 Signed-off-by: Mykhailo Kuznietsov --- .codecov.yml | 41 +++++++++++++++++++++++++++++++++ .github/workflows/pr-checks.yml | 13 +++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .codecov.yml 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