Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Cleanup #6631

Merged
merged 11 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/build-dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ runs:
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade jupyter_packaging~=0.10 "jupyterlab>=4.0.0a30,<5" build
python -m pip install hatch

- name: Build pypi distributions
shell: bash
run: |
python -m build
hatch build

- name: Build npm distributions
shell: bash
run: |
mkdir pkgs
jlpm lerna exec -- npm pack
hatch run npm_pack
cp packages/*/*.tgz pkgs

- name: Build checksum file
Expand Down
92 changes: 62 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,52 +39,66 @@ jobs:

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.11"

- name: Install the package
run: |
python -m pip install ".[dev,test]"
jlpm run build:test
- name: Test the package
run: hatch run cov:test

- name: Unit tests
- name: JavaScript tests
run: |
jlpm run test
pytest -vv || pytest -vv --lf
hatch run js_test

- name: Integration Tests
run: |
pip install .
cd
jupyter labextension list 2>&1 | grep -ie "@jupyter-notebook/lab-extension.*enabled.*ok" -
jupyter server extension list 2>&1 | grep -ie "notebook.*enabled" -
python -m jupyterlab.browser_check

test_prerelease:
test_docs:
name: Test Docs
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.10"

- name: Install the Python dependencies
run: |
pip install --no-deps .
pip install --pre --upgrade ".[dev,test]"
python -m pip install ".[dev,test]"
jlpm run build:test
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- run: |
# pandoc is not up to date in the ubuntu repos, so we install directly
wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-1-amd64.deb && sudo dpkg -i pandoc-2.14.2-1-amd64.deb
- run: hatch run docs:build

test_minimum_versions:
name: Test Minimum Versions
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.7"
- uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
with:
only_create_file: 1
- name: Run the unit tests
run: |
hatch run test:nowarn || hatch run test:nowarn --lf

- name: Python Unit tests
run: |
pytest -vv || pytest -vv --lf
test_prereleases:
name: Test Prereleases
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.11"
- name: Run the tests
run: |
PIP_PRE=1 hatch run test:nowarn || hatch run test:nowarn --lf

install:
needs: [build]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -131,7 +145,7 @@ jobs:
jupyter notebook --version
jupyter notebook --help

link_check:
check_links:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -149,3 +163,21 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- run: pip install -e .
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1


tests_check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- test
- install
- pre_commit
- test_docs
- test_minimum_versions
- test_prereleases
- check_links
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) }}
38 changes: 0 additions & 38 deletions .github/workflows/docs.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,10 @@ repos:
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.1
hooks:
- id: check-jsonschema
name: 'Check GitHub Workflows'
files: ^\.github/workflows/
types: [yaml]
args: ['--schemafile', 'https://json.schemastore.org/github-workflow']
stages: [manual]
- id: check-github-workflows

- repo: local
hooks:
Expand Down
15 changes: 12 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
conda:
file: docs/environment.yml
version: 2
sphinx:
configuration: docs/source/conf.py
build:
os: ubuntu-20.04
tools:
python: "3.9"
nodejs: "16"
python:
version: 3
install:
# install notebook itself
- method: pip
path: ".[docs]"
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coverage:
project:
default:
target: auto
threshold: 10
threshold: 1
patch:
default:
target: 0%
5 changes: 0 additions & 5 deletions docs/doc-requirements.txt

This file was deleted.

20 changes: 0 additions & 20 deletions docs/environment.yml

This file was deleted.

45 changes: 44 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ classifiers = [
]
dependencies = [
"jupyter_server>=2.0.0rc3,<3",
"importlib-resources>=5.0;python_version<\"3.9\"",
"jupyterlab>=4.0.0a31,<5",
"jupyterlab_server>=2.16.3,<3",
"notebook_shim>=0.2,<0.3",
Expand All @@ -51,7 +52,7 @@ Tracker = "https://github.com/jupyter/notebook/issues"
test = [
"coverage",
"nbval",
"pytest>=6.0",
"pytest>=7.0",
"pytest-cov",
"requests",
"pytest-tornasync",
Expand All @@ -61,6 +62,13 @@ test = [
"jupyter_server[test]>=2.0.0rc3,<3",
"jupyterlab_server[test]>=2.16.3,<3",
]
docs = [
"myst_parser",
"nbsphinx",
"pydata-sphinx-theme",
"sphinx>=1.3.6",
"sphinxcontrib_github_alt",
]
dev = [
"pre-commit",
"hatch"
Expand Down Expand Up @@ -99,6 +107,27 @@ artifacts = [
]
include = ["/notebook"]

[tool.hatch.envs.docs]
features = ["docs"]
[tool.hatch.envs.docs.scripts]
build = "make -C docs html SPHINXOPTS='-W'"

[tool.hatch.envs.default.scripts]
npm_pack = "jlpm lerna exec -- npm pack"
js_test = "jlpm run build:test && jlpm run test"

[tool.hatch.envs.test]
features = ["test"]
[tool.hatch.envs.test.scripts]
test = "python -m pytest -vv {args}"
nowarn = "test -W default {args}"

[tool.hatch.envs.cov]
features = ["test"]
dependencies = ["coverage", "pytest-cov"]
[tool.hatch.envs.cov.scripts]
test = "python -m pytest -vv --cov notebook --cov-branch --cov-report term-missing:skip-covered {args}"
nowarn = "test -W default {args}"

[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.2"]
Expand Down Expand Up @@ -129,6 +158,20 @@ filterwarnings = [
"ignore:clear_current is deprecated"
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]

[tool.flake8]
ignore = "E501, W503, E402"
builtins = "c, get_config"
Expand Down
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import os.path as osp
import pathlib
import shutil
from importlib.resources import files

try:
from importlib.resources import files
except ImportError:
from importlib_resources import files

import pytest

Expand Down