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 1 commit
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
27 changes: 27 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,29 @@ jobs:
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

run_doctests:
needs: style
runs-on: ubuntu-latest
strategy:
fail-fast: false
agriyakhetarpal marked this conversation as resolved.
Show resolved Hide resolved
name: Doctests (ubuntu-latest / Python 3.11)
santacodes marked this conversation as resolved.
Show resolved Hide resolved

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

- name: Set up Python
id: setup-python
santacodes marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-python@v5
with:
python-version: 3.11
santacodes marked this conversation as resolved.
Show resolved Hide resolved
cache: 'pip'

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

- name: Check if the documentation can be built for GNU/Linux
santacodes marked this conversation as resolved.
Show resolved Hide resolved
run: python -m nox -s docs
7 changes: 5 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,5 @@ 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).
`pybamm-cookiecutter` is fully open source. For more information about its license, see [LICENSE](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE).
santacodes marked this conversation as resolved.
Show resolved Hide resolved
<!-- 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
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/")
santacodes marked this conversation as resolved.
Show resolved Hide resolved
# 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",
)
santacodes marked this conversation as resolved.
Show resolved Hide resolved

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