From d02171e3701c15c2489e8cedeab7e53c435f29e6 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 10:26:54 +0000 Subject: [PATCH 1/4] 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. --- .codecov.yml | 10 ++++++++++ .github/workflows/build.yml | 16 +++++++++++++++- jest.config.js | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..407df99 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + target: auto + threshold: 0.05% + patch: + default: + target: auto + threshold: 0.05% diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 146472b..c434e86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,7 @@ jobs: set -eux python -m pip install .[test] - pytest -vv -r ap --cov jupyterlab_deepnote + pytest -vv -r ap --cov jupyterlab_deepnote --cov-report=xml --junit-xml=coverage/pytest-results.xml jupyter server extension list jupyter server extension list 2>&1 | grep -ie "jupyterlab_deepnote.*OK" @@ -54,6 +54,20 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml,./coverage/lcov.info + fail_ci_if_error: false + + - name: Upload test results to Codecov + if: '!cancelled()' + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage/pytest-results.xml,coverage/junit.xml + - name: Package the extension run: | set -eux diff --git a/jest.config.js b/jest.config.js index b0471e6..645177c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -23,6 +23,7 @@ module.exports = { '!src/**/.ipynb_checkpoints/*' ], coverageReporters: ['lcov', 'text'], + reporters: ['default', 'jest-junit'], testRegex: 'src/.*/.*.spec.ts[x]?$', transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`] }; From 884fdb9896397b7a7f9040757bbc8e52d8e77f51 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 10:36:53 +0000 Subject: [PATCH 2/4] fix: address codecov configuration issues - Create coverage directory before pytest runs to ensure junit xml output succeeds - Fix codecov upload file paths (coverage.xml and coverage/lcov.info) - Configure jest-junit to output to coverage/junit.xml explicitly - Set coverageDirectory to ./coverage for consistency Addresses CodeRabbit review comments. --- .github/workflows/build.yml | 3 ++- jest.config.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c434e86..9044112 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,7 @@ jobs: set -eux python -m pip install .[test] + mkdir -p coverage pytest -vv -r ap --cov jupyterlab_deepnote --cov-report=xml --junit-xml=coverage/pytest-results.xml jupyter server extension list jupyter server extension list 2>&1 | grep -ie "jupyterlab_deepnote.*OK" @@ -58,7 +59,7 @@ jobs: uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml,./coverage/lcov.info + files: coverage.xml,coverage/lcov.info fail_ci_if_error: false - name: Upload test results to Codecov diff --git a/jest.config.js b/jest.config.js index 645177c..248d8cf 100644 --- a/jest.config.js +++ b/jest.config.js @@ -22,8 +22,12 @@ module.exports = { '!src/**/*.d.ts', '!src/**/.ipynb_checkpoints/*' ], + coverageDirectory: './coverage', coverageReporters: ['lcov', 'text'], - reporters: ['default', 'jest-junit'], + reporters: [ + 'default', + ['jest-junit', { outputDirectory: './coverage', outputName: 'junit.xml' }] + ], testRegex: 'src/.*/.*.spec.ts[x]?$', transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`] }; From 5a4afbd7746eb0c04d3dc00b95232f2947a175c6 Mon Sep 17 00:00:00 2001 From: James Hobbs <15235276+jamesbhobbs@users.noreply.github.com> Date: Fri, 10 Oct 2025 11:47:33 +0100 Subject: [PATCH 3/4] ci: fail job on upload failure --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9044112..de1dbc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml,coverage/lcov.info - fail_ci_if_error: false + fail_ci_if_error: true - name: Upload test results to Codecov if: '!cancelled()' From 54f451d5cbe24e4d906c9bec2a1ec9011e6acc35 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 11:40:46 +0000 Subject: [PATCH 4/4] fix: set test results upload to fail CI on error Add fail_ci_if_error: true to test results upload step to ensure CI fails when codecov upload fails, matching the coverage upload configuration. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de1dbc3..86e7df3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,6 +68,7 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage/pytest-results.xml,coverage/junit.xml + fail_ci_if_error: true - name: Package the extension run: |