Skip to content

Commit

Permalink
CI Cleanup (#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 19, 2022
1 parent bde6eb9 commit 229f127
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 134 deletions.
123 changes: 50 additions & 73 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -eux {0}

jobs:
run-tests:
runs-on: ${{ matrix.os }}
env:
NBFORMAT_VALIDATOR: jsonschema
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
Expand All @@ -23,79 +29,32 @@ jobs:
python-version: "3.9"
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Run base setup actions
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge
- name: Install conda-forge python
shell: bash -l {0}
run: |
mamba create -n nbconvert
conda activate nbconvert
mamba install python=${{ matrix.python-version }}
- name: Install conda-forge dependencies
shell: bash -l {0}
run: |
mamba create -n nbconvert
conda activate nbconvert
mamba install pip pyqtwebengine pandoc pyxdg
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo apt-get update
sudo apt-get install texlive-plain-generic inkscape texlive-xetex
sudo apt-get install xvfb x11-utils libxkbcommon-x11-0
- name: Install package dependencies
shell: bash -l {0}
run: |
conda activate nbconvert
pip install codecov
pip install -e ".[execute,serve,test]"
which python
python -m ipykernel.kernelspec --sys-prefix
- name: List installed packages
shell: bash -l {0}
run: |
conda activate nbconvert
pip freeze
pip check
sudo apt-get install texlive-plain-generic inkscape texlive-xetex latexmk
sudo apt-get install xvfb x11-utils libxkbcommon-x11-0 libxcb-xinerama0 python3-pyqt5
- name: Run tests on MacOS
if: ${{ startsWith(runner.os, 'macos') }}
shell: bash -l {0}
run: |
conda activate nbconvert
# See https://github.com/pyppeteer/pyppeteer/pull/321
pip install -U websockets
python -m pytest --cov nbconvert -vv
# 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
- name: Run tests on Linux
if: ${{ startsWith(runner.os, 'linux') }}
shell: bash -l {0}
run: |
conda activate nbconvert
# See https://github.com/pyppeteer/pyppeteer/pull/321
pip install -U websockets
NBFORMAT_VALIDATOR=jsonschema xvfb-run --auto-servernum `which coverage` run -m pytest -vv
- name: Run tests on pypy and Windows
if: ${{ startsWith(runner.os, 'Windows') }}
shell: bash -l {0}
xvfb-run --auto-servernum hatch run cov:test
- name: Run tests on other platforms
if: ${{ !startsWith(runner.os, 'linux') }}
run: |
conda activate nbconvert
# See https://github.com/pyppeteer/pyppeteer/pull/321
pip install -U websockets
python -m pytest -vv
hatch run cov:test
- name: Code coverage
shell: bash -l {0}
run: |
conda activate nbconvert
pip install codecov
codecov
check_release:
Expand Down Expand Up @@ -140,31 +99,32 @@ jobs:
python_version: "3.7"
- name: Install miniumum versions
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
- 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"
export NBFORMAT_VALIDATOR=jsonschema
pytest -vv -W default || pytest -vv -W default --lf
hatch run test:nowarn || hatch run test:nowarn --lf
test_prereleases:
name: Test Prereleases
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
run: |
pip install --pre -e ".[test]"
- name: List installed packages
run: |
pip freeze
pip check
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.11"
- name: Run the tests
run: |
export PIP_PRE=1
export NBFORMAT_VALIDATOR=jsonschema
pytest -vv -W default || pytest -vv -W default --lf
hatch run test:nowarn || hatch run test:nowarn --lf
make_sdist:
name: Make SDist
Expand All @@ -183,3 +143,20 @@ jobs:
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1

tests_check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- run-tests
- pre_commit
- test_minimum_versions
- test_prereleases
- check_links
- check_release
- 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) }}
21 changes: 3 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,7 @@ repos:
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.18.4
- 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]

- repo: local
hooks:
- id: check-pyproject
name: check pyproject file
language: python
entry: python -m check_requirements
files: ^pyproject.toml$
stages: [manual]
additional_dependencies: ["tomli"]
- id: check-github-workflows
5 changes: 2 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ sphinx:

formats: all

conda:
environment: docs/environment.yml

build:
image: latest

Expand All @@ -21,3 +18,5 @@ python:
install:
- method: pip
path: .
extra_requirements:
- docs
3 changes: 1 addition & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ coverage:
project:
default:
target: auto
threshold: 10
threshold: 1
patch:
default:
target: 0%
comments: off
17 changes: 0 additions & 17 deletions docs/environment.yml

This file was deleted.

60 changes: 39 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,42 +56,26 @@ asciidoc = "nbconvert.exporters:ASCIIDocExporter"
script = "nbconvert.exporters:ScriptExporter"

[project.optional-dependencies]
qtpng = ["pyqtwebengine>=5.15"]
qtpdf = ["nbconvert[qtpng]"]
webpdf = ["pyppeteer>=1,<1.1"]
test = [
"pytest",
"pytest-cov",
"pytest-dependency",
"ipykernel",
"ipywidgets>=7",
"pre-commit",
"pyppeteer>=1,<1.1",
]
serve = ["tornado>=6.1"]
qtpdf = ["pyqtwebengine>=5.15"]
qtpng = ["pyqtwebengine>=5.15"]
webpdf = ["pyppeteer>=1,<1.1"]
docs = [
"myst_parser",
"sphinx==5.0.2",
"sphinx_rtd_theme",
"nbsphinx>=0.2.12",
"ipython",
]
all = [
"ipykernel",
"ipython",
"ipywidgets>=7",
"nbsphinx>=0.2.12",
"myst_parser",
"pre-commit",
"pytest",
"pytest-cov",
"pytest-dependency",
"pyqtwebengine>=5.15",
"pyppeteer>=1,<1.1",
"sphinx==5.0.2",
"sphinx_rtd_theme",
"tornado>=6.1",
]
all = ["nbconvert[qtpdf,webpdf,test,serve,docs]"]

[project.scripts]
jupyter-nbconvert = "nbconvert.nbconvertapp:main"
Expand All @@ -115,6 +99,25 @@ exclude = [
[tool.hatch.build.targets.wheel.shared-data]
"share/templates" = "share/jupyter/nbconvert/templates"

[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 = ["all"]
dependencies = ["coverage", "pytest-cov"]
[tool.hatch.envs.cov.scripts]
test = "python -m pytest -vv --cov nbconvert --cov-branch --cov-report term-missing:skip-covered {args}"
nowarn = "test -W default {args}"


[tool.pytest.ini_options]
markers = "network: marks tests which require network connection"
addopts = "-raXs --durations 10 --color=yes --doctest-modules --ignore=nbconvert/tests/files/override.py --ignore=nbconvert/tests/files/jupyter_nbconvert_config.py"
Expand All @@ -132,11 +135,26 @@ filterwarnings = [
"ignore:getargs.*format is deprecated:DeprecationWarning",
# From jupyter_client
"ignore:unclosed <socket.socket:ResourceWarning",
"ignore:unclosed event loop:ResourceWarning",
"ignore:There is no current event loop:DeprecationWarning",
"ignore:unclosed event loop:ResourceWarning",
# From jupyter_core
"module:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning",
]

[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

0 comments on commit 229f127

Please sign in to comment.