Skip to content
Snippets Groups Projects
Commit c92190d2 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Add docs session to nox; adapt CI

parent 1f5a7b44
No related branches found
No related tags found
1 merge request!436Introduce Nox for Local and CI Test Automation. Start Writing a Contributors Guide.
Pipeline #71848 failed
...@@ -311,14 +311,11 @@ tests-and-coverage: ...@@ -311,14 +311,11 @@ tests-and-coverage:
build-documentation: build-documentation:
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full:cupy12.3 image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:ubuntu24.04-cuda12
stage: docs stage: docs
needs: [] needs: []
before_script:
- pip install -e .[doc]
script: script:
- cd docs - nox --session docs
- make html SPHINXOPTS="-W --keep-going"
tags: tags:
- docker - docker
- cuda11 - cuda11
...@@ -328,7 +325,7 @@ build-documentation: ...@@ -328,7 +325,7 @@ build-documentation:
pages: pages:
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full image: alpine:latest
stage: deploy stage: deploy
needs: ["tests-and-coverage", "build-documentation"] needs: ["tests-and-coverage", "build-documentation"]
script: script:
......
...@@ -15,7 +15,7 @@ def get_cuda_version() -> None | tuple[int, ...]: ...@@ -15,7 +15,7 @@ def get_cuda_version() -> None | tuple[int, ...]:
result = subprocess.run(smi_args, capture_output=True) result = subprocess.run(smi_args, capture_output=True)
except FileNotFoundError: except FileNotFoundError:
return None return None
smi_output = str(result.stdout).splitlines() smi_output = str(result.stdout).splitlines()
cuda_version = smi_output[-1].split(":")[1].strip() cuda_version = smi_output[-1].split(":")[1].strip()
return tuple(int(v) for v in cuda_version.split(".")) return tuple(int(v) for v in cuda_version.split("."))
...@@ -45,18 +45,16 @@ def typecheck(session: nox.Session): ...@@ -45,18 +45,16 @@ def typecheck(session: nox.Session):
session.run("mypy", "src/pystencils") session.run("mypy", "src/pystencils")
@nox.parametrize( @nox.parametrize("cupy_version", [None, "12", "13"], ids=["cpu", "cupy12", "cupy13"])
"cupy_version",
[None, "12", "13"],
ids=["cpu", "cupy12", "cupy13"]
)
@nox.session(python="3.10", tags=["test"]) @nox.session(python="3.10", tags=["test"])
def testsuite(session: nox.Session, cupy_version: str | None): def testsuite(session: nox.Session, cupy_version: str | None):
if cupy_version is not None: if cupy_version is not None:
cuda_version = get_cuda_version() cuda_version = get_cuda_version()
if cuda_version is None or cuda_version[0] < 11: if cuda_version is None or cuda_version[0] < 11:
session.skip("No compatible installation of CUDA found - Need at least CUDA 11") session.skip(
"No compatible installation of CUDA found - Need at least CUDA 11"
)
cuda_major = cuda_version[0] cuda_major = cuda_version[0]
cupy_package = f"cupy-cuda{cuda_major}=={cupy_version}" cupy_package = f"cupy-cuda{cuda_major}=={cupy_version}"
session.install(cupy_package) session.install(cupy_package)
...@@ -68,12 +66,30 @@ def testsuite(session: nox.Session, cupy_version: str | None): ...@@ -68,12 +66,30 @@ def testsuite(session: nox.Session, cupy_version: str | None):
session.run( session.run(
"pytest", "pytest",
"-v", "-v",
"-n", str(num_cores), "-n",
str(num_cores),
"--cov-report=term", "--cov-report=term",
"--cov=.", "--cov=.",
"-m", "not longrun", "-m",
"--html", "test-report/index.html", "not longrun",
"--junitxml=report.xml" "--html",
"test-report/index.html",
"--junitxml=report.xml",
) )
session.run("coverage", "html") session.run("coverage", "html")
session.run("coverage", "xml") session.run("coverage", "xml")
@nox.session(python=["3.10"], tags=["docs"])
def docs(session: nox.Session):
"""Build the documentation pages"""
editable_install(session, ["doc"])
session.chdir("docs")
session.run(
"make",
"html",
external=True,
env={
"SPHINXOPTS": "-W --keep-going"
}
)
...@@ -57,7 +57,9 @@ doc = [ ...@@ -57,7 +57,9 @@ doc = [
'sphinx_autodoc_typehints', 'sphinx_autodoc_typehints',
'pandoc', 'pandoc',
'sphinx_design', 'sphinx_design',
'myst-nb' 'myst-nb',
'matplotlib',
'graphviz',
] ]
testsuite = [ testsuite = [
'pytest', 'pytest',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment