From 291595ed2a4fa882772550a57ffdc11a6652f3e1 Mon Sep 17 00:00:00 2001 From: Petr Toman Date: Wed, 3 Jun 2026 12:58:49 +0200 Subject: [PATCH] feat: add Codecov integration for unit test coverage - Add lcov reporter to c8 config for Codecov-compatible output - Add Codecov upload step to test workflow with OIDC auth - Add permissions: id-token: write for OIDC token - Add codecov.yml with informational status checks and unit-tests flag Ref: COVERPORT-254 Co-Authored-By: Claude Opus 4.6 --- .github/workflows/test.yml | 11 +++++++++++ codecov.yml | 25 +++++++++++++++++++++++++ package.json | 1 + 3 files changed, 37 insertions(+) create mode 100644 codecov.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 837c2e26..37691fc7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,8 @@ jobs: test: runs-on: ubuntu-latest name: Lint and test project + permissions: + id-token: write strategy: matrix: node: ['22', '24'] @@ -111,3 +113,12 @@ jobs: name: coverage path: ./coverage/coverage-final.json + - name: Upload coverage to Codecov + if: ${{ matrix.node == env.MAIN_NODE_VER }} + uses: codecov/codecov-action@v5 + with: + use_oidc: true + flags: unit-tests + files: ./coverage/lcov.info + slug: guacsec/trustify-da-javascript-client + diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..0533fbf5 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,25 @@ +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true + +ignore: + - "node_modules/**" + - "dist/**" + - "coverage/**" + +flags: + unit-tests: + carryforward: true + +comment: + layout: "reach,diff,flags,files" + behavior: default diff --git a/package.json b/package.json index db75ae72..3adfdb15 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "reporter": [ "html", "json", + "lcov", "text" ] },