From 77c3d6eeb73f4b53b0c940516b5c833bd78229e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20=C5=9Een?= Date: Wed, 27 May 2026 08:23:52 +0300 Subject: [PATCH 1/2] feat(ci): add GitHub native code coverage upload - Add cobertura reporter to vitest coverage config - Add code-quality:write permission to CI workflow - Upload coverage via actions/upload-code-coverage@v1 on Node 20.x only - Other Node versions (18.x, 22.x) run tests without coverage to avoid duplicate uploads Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ci.yml | 17 +++++++++++++++++ vitest.config.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02b804a..bb82d7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,10 @@ jobs: name: Build & Test runs-on: ubuntu-latest + permissions: + contents: read + code-quality: write + strategy: matrix: node-version: [18.x, 20.x, 22.x] @@ -34,7 +38,20 @@ jobs: run: npm run build - name: Test + if: matrix.node-version != '20.x' run: npm test + - name: Test with coverage + if: matrix.node-version == '20.x' + run: npm run test:coverage + + - name: Upload code coverage + if: matrix.node-version == '20.x' + uses: actions/upload-code-coverage@v1 + with: + file: coverage/cobertura-coverage.xml + language: TypeScript + label: code-coverage/vitest + - name: Lint (Biome) run: npm run check diff --git a/vitest.config.ts b/vitest.config.ts index 1336826..be009b5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ environment: 'node', coverage: { provider: 'v8', - reporter: ['text', 'json', 'html'], + reporter: ['text', 'json', 'html', 'cobertura'], include: ['src/**/*.ts'], exclude: ['src/**/index.ts'], }, From dc7db78e512499f87b79ca02f1d5827f6f84ef56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20=C5=9Een?= Date: Wed, 27 May 2026 08:32:15 +0300 Subject: [PATCH 2/2] fix(ci): switch to Codecov for coverage upload Replace actions/upload-code-coverage@v1 (requires GitHub Team plan) with codecov/codecov-action@v5. Remove code-quality:write permission. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb82d7e..6afbc47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ jobs: permissions: contents: read - code-quality: write strategy: matrix: @@ -45,13 +44,13 @@ jobs: if: matrix.node-version == '20.x' run: npm run test:coverage - - name: Upload code coverage + - name: Upload coverage to Codecov if: matrix.node-version == '20.x' - uses: actions/upload-code-coverage@v1 + uses: codecov/codecov-action@v5 with: - file: coverage/cobertura-coverage.xml - language: TypeScript - label: code-coverage/vitest + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage/cobertura-coverage.xml + fail_ci_if_error: true - name: Lint (Biome) run: npm run check