Skip to content

Commit dde29cd

Browse files
committed
fix: improve codecov integration with better debugging and fallback
- Fix codecov action parameter (files -> file) - Add verbose logging and debug output - Add fallback upload method if primary fails - Improve vitest coverage config with HTML reporter and exclusions - Set fail_ci_if_error to false to prevent blocking builds
1 parent c33ab6f commit dde29cd

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,24 @@ jobs:
1313
- run: npm ci
1414
- run: npm run lint
1515
- run: npm run test:ci
16+
- name: Debug coverage files
17+
run: |
18+
echo "Coverage directory contents:"
19+
ls -la coverage/ || dir coverage\
20+
echo "LCOV file size:"
21+
wc -c coverage/lcov.info || (Get-Item coverage\lcov.info).Length
22+
echo "LCOV file first 10 lines:"
23+
head -10 coverage/lcov.info || Get-Content coverage\lcov.info | Select-Object -First 10
1624
- name: Upload coverage to Codecov
1725
uses: codecov/codecov-action@v4
1826
with:
19-
files: ./coverage/lcov.info
20-
fail_ci_if_error: true
21-
token: ${{ secrets.CODECOV_TOKEN }}
27+
file: ./coverage/lcov.info
28+
fail_ci_if_error: false
29+
token: ${{ secrets.CODECOV_TOKEN }}
30+
verbose: true
31+
- name: Upload coverage to Codecov (fallback)
32+
if: failure()
33+
run: |
34+
curl -Os https://cli.codecov.io/latest/linux/codecov
35+
chmod +x codecov
36+
./codecov --verbose upload-process --fail-on-error --file ./coverage/lcov.info --token ${{ secrets.CODECOV_TOKEN }}

vitest.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export default defineConfig({
44
test: {
55
globals: true,
66
environment: 'happy-dom', // fetch in browser-like env
7-
coverage: { reporter: ['text', 'lcov'] },
7+
coverage: {
8+
reporter: ['text', 'lcov', 'html'],
9+
exclude: ['coverage/**', 'dist/**', '**/*.config.*', '**/*.test.*'],
10+
},
811
},
912
})

0 commit comments

Comments
 (0)