Skip to content

Commit

Permalink
added doc test for build
Browse files Browse the repository at this point in the history
  • Loading branch information
santacodes committed Jul 9, 2024
1 parent 6636bcf commit ead482c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main
- cidoc
jobs:
style:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,3 +53,29 @@ jobs:
- name: Test Template Generation
run: |
nox -s test-generation
run_doctests:
needs: style
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Doctests (ubuntu-latest / Python 3.11)

steps:
- name: Check out pybamm-cookiecutter repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'

- name: Install nox
run: python -m pip install nox

- name: Check if the documentation can be built for GNU/Linux
run: python -m nox -s docs
15 changes: 14 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def build_docs(session: nox.Session) -> None:
"""Build the documentation and load it in a browser tab, rebuilding on changes."""
envbindir = session.bin
session.install("-e", ".[docs]")
with session.chdir("docs/"):
session.chdir("docs/")
# For local development
if session.interactive:
session.run(
"sphinx-autobuild",
"-j",
Expand All @@ -23,6 +25,17 @@ def build_docs(session: nox.Session) -> None:
".",
f"{envbindir}/../tmp/html",
)
# For CI testing if documentation builds
else:
session.run(
"sphinx-build",
"-b",
"html",
"-W",
"--keep-going",
".",
f"{envbindir}/../tmp/html",
)

@nox.session(name="test-generation")
def run_template_generation(session):
Expand Down

0 comments on commit ead482c

Please sign in to comment.