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

Check example notebooks #75

Merged
merged 4 commits into from
Aug 17, 2024
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
43 changes: 43 additions & 0 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Notebooks

on: [push, pull_request]

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
test-notebooks:
name: Check notebooks
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ${{ matrix.os }}

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

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
auto-update-conda: true

- name: Install nox
run: pip install nox

- name: Check Jupyter notebooks
env:
MPLBACKEND: "Agg"
run: |
nox --verbose -s check-notebooks --force-pythons="${{ matrix.python-version }}"
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ concurrency:
jobs:

test:
name: Run unit tests
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
Expand Down
17 changes: 17 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ def test_cli(session: nox.Session) -> None:
session.run(PROJECT, "--help")


@nox.session(name="check-notebooks", python=PYTHON_VERSIONS[-1])
def check_notebooks(session: nox.Session) -> None:
"""Run the example notebooks."""
session.install(".[testing,examples]")
session.install("nbmake")

args = [
"examples",
"--nbmake",
"--nbmake-kernel=python3",
"--nbmake-timeout=3000",
"-vvv",
] + session.posargs

session.run("pytest", *args)


@nox.session
def lint(session: nox.Session) -> None:
"""Clean lint and assert style."""
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ addopts = """
--durations 16
--doctest-modules
-vvv
--ignore-glob=examples/*.py
"""
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
Expand Down