Skip to content

Commit 6475043

Browse files
committed
added tests for template generation in ci
1 parent 13e2251 commit 6475043

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/test_on_push.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: pybamm_cookiecutter
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
style:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Setup Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: 3.12
16+
17+
- name: Check style
18+
run: |
19+
python -m pip install pre-commit
20+
pre-commit run -a
21+
22+
template_test:
23+
needs: style
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
29+
python-version: ["3.9", "3.10", "3.11", "3.12"]
30+
name:
31+
Template Tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
32+
steps:
33+
- name: Checkout pybamm_cookiecutter
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python ${{ matrix.python-version }}
37+
id: setup-python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
cache: 'pip'
42+
43+
- name: Set up uv
44+
uses: yezz123/setup-uv@v4
45+
with:
46+
uv-venv: ".venv"
47+
48+
- name: Install nox
49+
run: uv pip install nox
50+
51+
- name: Test Template Generation
52+
run: |
53+
nox -s test-generation

noxfile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import nox
22

33
# Options to modify nox behaviour
4+
nox.options.default_venv_backend = "uv|virtualenv"
45
nox.options.reuse_existing_virtualenvs = True
56

67
@nox.session(name="docs")
@@ -18,3 +19,12 @@ def build_docs(session: nox.Session) -> None:
1819
".",
1920
f"{envbindir}/../tmp/html",
2021
)
22+
23+
@nox.session(name="test-generation")
24+
def run_template_generation(session):
25+
"""Run the tests tests for testing template generation"""
26+
session.install("setuptools", silent=False)
27+
session.install("pytest", silent=False)
28+
session.install("pytest-cookies", silent=False)
29+
session.install("-e", ".", silent=False)
30+
session.run("pytest", "tests")

0 commit comments

Comments
 (0)