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

Added doctest to CI #25

Merged
merged 4 commits into from
Jul 18, 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
24 changes: 24 additions & 0 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- main


jobs:
style:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -63,3 +64,26 @@ jobs:
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

run_doctests:
needs: style
runs-on: ubuntu-latest
name: Doctests (ubuntu-latest / Python 3.12)

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

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

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

- name: Check if the documentation can be built
run: python -m nox -s docs
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
[pypi-version]: https://img.shields.io/pypi/v/pybamm-cookiecutter
[rtd-badge]: https://readthedocs.org/projects/pybamm-cookiecutter/badge/?version=latest
[rtd-link]: https://pybamm-cookiecutter.readthedocs.io/en/latest/?badge=latest -->

<!-- SPHINX-START -->
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](http://numfocus.org)

This repository contains a `cookiecutter` template for battery modeling projects using PyBaMM, released under the [BSD-3-Clause license](LICENSE). Currently under active development.
This repository contains a `cookiecutter` template for battery modeling projects using PyBaMM, released under the [BSD-3-Clause license](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE). Currently under active development.

## 📄 Using `pybamm-cookiecutter`

Expand Down Expand Up @@ -82,4 +84,6 @@ For any questions, comments, suggestions or bug reports, please see the

## 📃 License

`pybamm-cookiecutter` is fully open source. For more information about its license, see [LICENSE](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE.txt).
The `pybamm-cookiecutter` project is open source code. For more information about its license, see [LICENSE](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE).

<!-- SPHINX-END -->
santacodes marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

```{include} ../README.md
:start-after: <!-- SPHINX-START -->
:end-before: <!-- SPHINX-END -->
```

## Indices and tables
Expand Down
32 changes: 22 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,30 @@
@nox.session(name="docs")
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.run(
"sphinx-autobuild",
"-j",
"auto",
"--open-browser",
"-qT",
".",
f"{envbindir}/../tmp/html",
)
# For local development
if session.interactive:
session.run(
"sphinx-autobuild",
"-j",
"auto",
"--open-browser",
"-qT",
".",
"build/html/",
)
# For CI testing if documentation builds
else:
session.run(
"sphinx-build",
"-b",
"html",
"-W",
"--keep-going",
".",
"build/html/",
)

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