Skip to content

Commit 1b50ded

Browse files
authored
Merge pull request #6631 from blink1073/ci-cleanup
CI Cleanup
2 parents aa04298 + 8ccc516 commit 1b50ded

File tree

10 files changed

+129
-109
lines changed

10 files changed

+129
-109
lines changed

.github/actions/build-dist/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ runs:
99
- name: Install dependencies
1010
shell: bash
1111
run: |
12-
python -m pip install --upgrade jupyter_packaging~=0.10 "jupyterlab>=4.0.0a30,<5" build
12+
python -m pip install hatch
1313
1414
- name: Build pypi distributions
1515
shell: bash
1616
run: |
17-
python -m build
17+
hatch build
1818
1919
- name: Build npm distributions
2020
shell: bash
2121
run: |
2222
mkdir pkgs
23-
jlpm lerna exec -- npm pack
23+
hatch run npm_pack
2424
cp packages/*/*.tgz pkgs
2525
2626
- name: Build checksum file

.github/workflows/build.yml

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,52 +39,66 @@ jobs:
3939

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

45-
- name: Install the package
46-
run: |
47-
python -m pip install ".[dev,test]"
48-
jlpm run build:test
43+
- name: Test the package
44+
run: hatch run cov:test
4945

50-
- name: Unit tests
46+
- name: JavaScript tests
5147
run: |
52-
jlpm run test
53-
pytest -vv || pytest -vv --lf
48+
hatch run js_test
5449
5550
- name: Integration Tests
5651
run: |
52+
pip install .
53+
cd
5754
jupyter labextension list 2>&1 | grep -ie "@jupyter-notebook/lab-extension.*enabled.*ok" -
5855
jupyter server extension list 2>&1 | grep -ie "notebook.*enabled" -
5956
python -m jupyterlab.browser_check
6057
61-
test_prerelease:
58+
test_docs:
59+
name: Test Docs
6260
runs-on: ubuntu-latest
63-
timeout-minutes: 10
6461
steps:
65-
- name: Checkout
66-
uses: actions/checkout@v3
67-
68-
- name: Base Setup
69-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
70-
with:
71-
python_version: "3.10"
72-
73-
- name: Install the Python dependencies
74-
run: |
75-
pip install --no-deps .
76-
pip install --pre --upgrade ".[dev,test]"
77-
python -m pip install ".[dev,test]"
78-
jlpm run build:test
62+
- uses: actions/checkout@v3
63+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
64+
- run: |
65+
# pandoc is not up to date in the ubuntu repos, so we install directly
66+
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
67+
- run: hatch run docs:build
68+
69+
test_minimum_versions:
70+
name: Test Minimum Versions
71+
timeout-minutes: 20
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v3
75+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
76+
with:
77+
python_version: "3.7"
78+
- uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
79+
with:
80+
only_create_file: 1
81+
- name: Run the unit tests
82+
run: |
83+
hatch run test:nowarn || hatch run test:nowarn --lf
7984
80-
- name: Python Unit tests
81-
run: |
82-
pytest -vv || pytest -vv --lf
85+
test_prereleases:
86+
name: Test Prereleases
87+
runs-on: ubuntu-latest
88+
timeout-minutes: 20
89+
steps:
90+
- uses: actions/checkout@v3
91+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
92+
with:
93+
python_version: "3.11"
94+
- name: Run the tests
95+
run: |
96+
PIP_PRE=1 hatch run test:nowarn || hatch run test:nowarn --lf
8397
8498
install:
8599
needs: [build]
86100
runs-on: ${{ matrix.os }}
87-
timeout-minutes: 10
101+
timeout-minutes: 15
88102
strategy:
89103
fail-fast: false
90104
matrix:
@@ -131,7 +145,7 @@ jobs:
131145
jupyter notebook --version
132146
jupyter notebook --help
133147
134-
link_check:
148+
check_links:
135149
runs-on: ubuntu-latest
136150
timeout-minutes: 10
137151
steps:
@@ -149,3 +163,21 @@ jobs:
149163
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
150164
- run: pip install -e .
151165
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1
166+
167+
168+
tests_check: # This job does nothing and is only used for the branch protection
169+
if: always()
170+
needs:
171+
- test
172+
- install
173+
- pre_commit
174+
- test_docs
175+
- test_minimum_versions
176+
- test_prereleases
177+
- check_links
178+
runs-on: ubuntu-latest
179+
steps:
180+
- name: Decide whether the needed jobs succeeded or failed
181+
uses: re-actors/alls-green@release/v1
182+
with:
183+
jobs: ${{ toJSON(needs) }}

.github/workflows/docs.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,10 @@ repos:
5656
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
5757
stages: [manual]
5858

59-
- repo: https://github.com/sirosen/check-jsonschema
59+
- repo: https://github.com/python-jsonschema/check-jsonschema
6060
rev: 0.19.1
6161
hooks:
62-
- id: check-jsonschema
63-
name: 'Check GitHub Workflows'
64-
files: ^\.github/workflows/
65-
types: [yaml]
66-
args: ['--schemafile', 'https://json.schemastore.org/github-workflow']
67-
stages: [manual]
62+
- id: check-github-workflows
6863

6964
- repo: local
7065
hooks:

.readthedocs.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
conda:
2-
file: docs/environment.yml
1+
version: 2
2+
sphinx:
3+
configuration: docs/source/conf.py
4+
build:
5+
os: ubuntu-20.04
6+
tools:
7+
python: "3.9"
8+
nodejs: "16"
39
python:
4-
version: 3
10+
install:
11+
# install notebook itself
12+
- method: pip
13+
path: ".[docs]"

codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ coverage:
33
project:
44
default:
55
target: auto
6-
threshold: 10
6+
threshold: 1
77
patch:
88
default:
99
target: 0%

docs/doc-requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/environment.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

pyproject.toml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ classifiers = [
3131
]
3232
dependencies = [
3333
"jupyter_server>=2.0.0rc3,<3",
34+
"importlib-resources>=5.0;python_version<\"3.9\"",
3435
"jupyterlab>=4.0.0a31,<5",
3536
"jupyterlab_server>=2.16.3,<3",
3637
"notebook_shim>=0.2,<0.3",
@@ -51,7 +52,7 @@ Tracker = "https://github.com/jupyter/notebook/issues"
5152
test = [
5253
"coverage",
5354
"nbval",
54-
"pytest>=6.0",
55+
"pytest>=7.0",
5556
"pytest-cov",
5657
"requests",
5758
"pytest-tornasync",
@@ -61,6 +62,13 @@ test = [
6162
"jupyter_server[test]>=2.0.0rc3,<3",
6263
"jupyterlab_server[test]>=2.16.3,<3",
6364
]
65+
docs = [
66+
"myst_parser",
67+
"nbsphinx",
68+
"pydata-sphinx-theme",
69+
"sphinx>=1.3.6",
70+
"sphinxcontrib_github_alt",
71+
]
6472
dev = [
6573
"pre-commit",
6674
"hatch"
@@ -99,6 +107,27 @@ artifacts = [
99107
]
100108
include = ["/notebook"]
101109

110+
[tool.hatch.envs.docs]
111+
features = ["docs"]
112+
[tool.hatch.envs.docs.scripts]
113+
build = "make -C docs html SPHINXOPTS='-W'"
114+
115+
[tool.hatch.envs.default.scripts]
116+
npm_pack = "jlpm lerna exec -- npm pack"
117+
js_test = "jlpm run build:test && jlpm run test"
118+
119+
[tool.hatch.envs.test]
120+
features = ["test"]
121+
[tool.hatch.envs.test.scripts]
122+
test = "python -m pytest -vv {args}"
123+
nowarn = "test -W default {args}"
124+
125+
[tool.hatch.envs.cov]
126+
features = ["test"]
127+
dependencies = ["coverage", "pytest-cov"]
128+
[tool.hatch.envs.cov.scripts]
129+
test = "python -m pytest -vv --cov notebook --cov-branch --cov-report term-missing:skip-covered {args}"
130+
nowarn = "test -W default {args}"
102131

103132
[tool.hatch.build.hooks.jupyter-builder]
104133
dependencies = ["hatch-jupyter-builder>=0.2"]
@@ -129,6 +158,20 @@ filterwarnings = [
129158
"ignore:clear_current is deprecated"
130159
]
131160

161+
[tool.coverage.report]
162+
exclude_lines = [
163+
"pragma: no cover",
164+
"def __repr__",
165+
"if self.debug:",
166+
"if settings.DEBUG",
167+
"raise AssertionError",
168+
"raise NotImplementedError",
169+
"if 0:",
170+
"if __name__ == .__main__.:",
171+
"class .*\bProtocol\\):",
172+
"@(abc\\.)?abstractmethod",
173+
]
174+
132175
[tool.flake8]
133176
ignore = "E501, W503, E402"
134177
builtins = "c, get_config"

tests/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
import os.path as osp
55
import pathlib
66
import shutil
7-
from importlib.resources import files
7+
8+
try:
9+
from importlib.resources import files
10+
except ImportError:
11+
from importlib_resources import files
812

913
import pytest
1014

0 commit comments

Comments
 (0)