Skip to content

Commit d02171e

Browse files
feat: add codecov integration with test results upload
- Add .codecov.yml configuration with project and patch coverage checks (0.05% threshold) - Configure jest to output test results in JUnit XML format using jest-junit reporter - Update pytest to output coverage in XML format and test results in JUnit XML format - Add codecov/codecov-action@v5 step to upload coverage from both jest (lcov) and pytest (xml) - Add codecov/test-results-action@v1 step to upload test results from both test suites - Set fail_ci_if_error: false for coverage upload to prevent blocking CI if codecov has issues - Use if: '!cancelled()' for test results upload to ensure results are uploaded even if tests fail Follows the same codecov configuration pattern as deepnote-internal and deepnote-toolkit repos. Note: CODECOV_TOKEN secret needs to be configured in repository settings for codecov uploads to work.
1 parent 7ac4a8e commit d02171e

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

.codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 0.05%
7+
patch:
8+
default:
9+
target: auto
10+
threshold: 0.05%

.github/workflows/build.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
set -eux
4545
python -m pip install .[test]
4646
47-
pytest -vv -r ap --cov jupyterlab_deepnote
47+
pytest -vv -r ap --cov jupyterlab_deepnote --cov-report=xml --junit-xml=coverage/pytest-results.xml
4848
jupyter server extension list
4949
jupyter server extension list 2>&1 | grep -ie "jupyterlab_deepnote.*OK"
5050
@@ -54,6 +54,20 @@ jobs:
5454
env:
5555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5656

57+
- name: Upload coverage to Codecov
58+
uses: codecov/codecov-action@v5
59+
with:
60+
token: ${{ secrets.CODECOV_TOKEN }}
61+
files: ./coverage.xml,./coverage/lcov.info
62+
fail_ci_if_error: false
63+
64+
- name: Upload test results to Codecov
65+
if: '!cancelled()'
66+
uses: codecov/test-results-action@v1
67+
with:
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
files: coverage/pytest-results.xml,coverage/junit.xml
70+
5771
- name: Package the extension
5872
run: |
5973
set -eux

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
'!src/**/.ipynb_checkpoints/*'
2424
],
2525
coverageReporters: ['lcov', 'text'],
26+
reporters: ['default', 'jest-junit'],
2627
testRegex: 'src/.*/.*.spec.ts[x]?$',
2728
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`]
2829
};

0 commit comments

Comments
 (0)