Skip to content

Commit 0b41226

Browse files
feat: add codecov integration with test results upload (#35)
* feat: add codecov integration with test results upload - Add lcov reporter to nyc configuration for codecov compatibility - Add codecov upload steps to CI workflow for coverage and test results - Configure fail_ci_if_error: false to not block CI on codecov issues Project already has .github/codecov.yml with project and patch coverage checks configured. * fix: add coverage instrumentation env var and fail_ci_if_error to test results upload - Add VSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE env var to test step to enable coverage generation - Add fail_ci_if_error: false to test results upload for consistency with coverage upload Addresses CodeRabbit automated review feedback on PR #35 * fix: set codecov uploads to fail CI on error Change fail_ci_if_error from false to true for both coverage and test results uploads to ensure CI fails when codecov upload fails, as requested by user. --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 3a973eb commit 0b41226

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,23 @@ jobs:
9191

9292
- name: Run tests
9393
run: npm test
94+
env:
95+
VSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE: true
96+
97+
- name: Upload coverage to Codecov
98+
uses: codecov/codecov-action@v5
99+
with:
100+
token: ${{ secrets.CODECOV_TOKEN }}
101+
files: coverage/lcov.info
102+
fail_ci_if_error: true
103+
104+
- name: Upload test results to Codecov
105+
if: '!cancelled()'
106+
uses: codecov/test-results-action@v1
107+
with:
108+
token: ${{ secrets.CODECOV_TOKEN }}
109+
files: test-report.xml
110+
fail_ci_if_error: true
94111

95112
- name: Check dependencies
96113
run: npm run checkDependencies

src/test/coverage.node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function setupCoverage() {
1414
return;
1515
}
1616
const htmlReport = process.env.VSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE_HTML ? ['html'] : [];
17-
const reports = htmlReport.concat(['text', 'text-summary']);
17+
const reports = htmlReport.concat(['text', 'text-summary', 'lcov']);
1818
const NYC = require('nyc');
1919
const nyc = new NYC({
2020
cwd: path.join(EXTENSION_ROOT_DIR_FOR_TESTS),

0 commit comments

Comments
 (0)