From e1a2ea092536816df822062a22407ec854d03c42 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 14:09:38 -0600 Subject: [PATCH] ci cleanup --- .github/workflows/build.yml | 86 ++++++++++++++++++++++++++----------- .github/workflows/docs.yml | 38 ---------------- .pre-commit-config.yaml | 9 +--- .readthedocs.yaml | 11 +++-- codecov.yml | 2 +- docs/doc-requirements.txt | 5 --- docs/environment.yml | 20 --------- pyproject.toml | 38 ++++++++++++++++ 8 files changed, 110 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 docs/doc-requirements.txt delete mode 100644 docs/environment.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f652d4a2a..6f40489e7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,46 +40,63 @@ jobs: - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 with: - python_version: "3.11" + python_version: "3.12" - - name: Install the package + - name: Test the package run: | - python -m pip install ".[dev,test]" - jlpm run build:test + hatch run cov:test - - name: Unit tests + - name: JavaScript tests run: | + pip install jupyterlab + jlpm run build:test jlpm run test - pytest -vv || pytest -vv --lf - 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" + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - run: hatch run docs:build - - 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 + 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.8" + - uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 + with: + only_create_file: 1 + - name: Run the unit tests + run: | + export PIP_CONSTRAINT="./contraints_file.txt" + 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] @@ -131,7 +148,7 @@ jobs: jupyter notebook --version jupyter notebook --help - link_check: + check_linkts: runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -149,3 +166,22 @@ jobs: - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - run: pip install -e . - uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1 + + + python_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 + - 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) }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 0d4bd5d01c..0000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Docs Tests -on: - push: - branches: ['main'] - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: true - -jobs: - build: - 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.7' - - name: Install the Python dependencies - run: | - pip install -e .[dev,test] codecov - pip install -r docs/doc-requirements.txt - wget https://github.com/jgm/pandoc/releases/download/1.19.1/pandoc-1.19.1-1-amd64.deb && sudo dpkg -i pandoc-1.19.1-1-amd64.deb - - name: List installed packages - run: | - pip freeze - pip check - - name: Run tests on documentation - run: | - EXIT_STATUS=0 - make -C docs/ html SPHINXOPTS="-W" || EXIT_STATUS=$? - # Ignore warnings to work around - # # https://github.com/computationalmodelling/nbval/issues/180 - pytest --nbval --current-env -W default docs || EXIT_STATUS=$? - exit $EXIT_STATUS diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 03daef05e3..f393decd0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b9eadb806d..1e1be498e6 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,4 +1,9 @@ -conda: - file: docs/environment.yml +version: 2 +sphinx: + configuration: docs/source/conf.py python: - version: 3 + version: 3.8 + install: + # install notebook itself + - method: pip + path: ".[docs]" diff --git a/codecov.yml b/codecov.yml index eb9b9dff30..b75c3e2dbc 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,7 +3,7 @@ coverage: project: default: target: auto - threshold: 10 + threshold: 1 patch: default: target: 0% diff --git a/docs/doc-requirements.txt b/docs/doc-requirements.txt deleted file mode 100644 index be686e5584..0000000000 --- a/docs/doc-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -myst_parser -nbsphinx -pydata-sphinx-theme -sphinx>=1.3.6 -sphinxcontrib_github_alt diff --git a/docs/environment.yml b/docs/environment.yml deleted file mode 100644 index 5681ebe120..0000000000 --- a/docs/environment.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: notebook_docs -channels: - - conda-forge -dependencies: -- python=3.8 -- pydata-sphinx-theme -- jinja2 -- tornado -- nbformat -- jupyter_client -- ipykernel -- pip -- sphinx -- terminado -- myst-parser -- pip: - - nbsphinx - - Send2Trash - - prometheus_client - - sphinxcontrib_github_alt diff --git a/pyproject.toml b/pyproject.toml index 752e490d55..1bebf8ef24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,6 +60,13 @@ test = [ "ipykernel", "jupyterlab_server[test]>=2.13,<3", ] +docs = [ + "myst_parser", + "nbsphinx", + "pydata-sphinx-theme", + "sphinx>=1.3.6", + "sphinxcontrib_github_alt", +] dev = [ "pre-commit", "hatch" @@ -98,6 +105,23 @@ artifacts = [ ] include = ["/notebook"] +[tool.hatch.envs.docs] +features = ["docs"] +[tool.hatch.envs.docs.scripts] +build = "make -C docs html SPHINXOPTS='-W'" + +[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"] @@ -128,6 +152,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"