Skip to content

Improve Coverage Accuracy and Speed Up Tests #185

Improve Coverage Accuracy and Speed Up Tests

Improve Coverage Accuracy and Speed Up Tests #185

Workflow file for this run

name: Jupyter Builder Tests
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -eux {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: python -m pip install .[test]
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Build the extension
run: |
set -eux
jlpm
jlpm run build
- name: Package the extension
run: |
set -eux
pip install build
python -m build
- name: Upload extension packages
uses: actions/upload-artifact@v7
with:
name: extension-artifacts
path: dist/jupyter_builder*
if-no-files-found: error
test_isolated:
needs: build
runs-on: ubuntu-latest
steps:
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
architecture: 'x64'
- uses: actions/download-artifact@v8
with:
name: extension-artifacts
- name: Install and Test
run: |
set -eux
pip install jupyter_builder*.whl
jupyter-builder --version
jlpm --version
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.14"]
include:
- os: ubuntu-latest
python-version: "pypy-3.11"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
-
run: pip install -e ".[test,dev]"
- name: Run the tests
run: pytest --cov
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
test_lint:
name: Test Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
-
run: pip install -e ".[test,dev]"
- name: Run Linters
run: |
python -m pre_commit run --all
# pipx run interrogate -v .
test_minimum_versions:
name: Test Minimum Versions
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: minimum
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- run: pip install -e ".[test,dev]"
- name: Run the unit tests
run: pytest
test_prereleases:
name: Test Prereleases
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: pre
python_version: "3.14" # TODO: remove once rpds-py supports 3.15
- run: pip install -e ".[test,dev]"
- name: Run the tests
run: pytest
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1
test_sdist:
runs-on: ubuntu-latest
needs: [make_sdist]
name: Install from SDist and Test
timeout-minutes: 20
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
with:
package_spec: -vv .[test]
test_command: pytest
check_links:
name: Check Links
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
coverage:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v7
- uses: jupyterlab/maintainer-tools/.github/actions/report-coverage@v1
with:
fail_under: 80
tests_check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- test_isolated
- test
- build
- test_lint
- test_minimum_versions
- test_prereleases
- check_links
- test_sdist
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}