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..86e7df3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,8 @@ jobs: set -eux python -m pip install .[test] - pytest -vv -r ap --cov jupyterlab_deepnote + 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" @@ -54,6 +55,21 @@ 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: true + + - 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 + fail_ci_if_error: true + - name: Package the extension run: | set -eux diff --git a/jest.config.js b/jest.config.js index b0471e6..248d8cf 100644 --- a/jest.config.js +++ b/jest.config.js @@ -22,7 +22,12 @@ module.exports = { '!src/**/*.d.ts', '!src/**/.ipynb_checkpoints/*' ], + coverageDirectory: './coverage', coverageReporters: ['lcov', 'text'], + reporters: [ + 'default', + ['jest-junit', { outputDirectory: './coverage', outputName: 'junit.xml' }] + ], testRegex: 'src/.*/.*.spec.ts[x]?$', transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`] };