Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
1f5a7b44
Commit
1f5a7b44
authored
5 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
introduce Nox and refactor CI
parent
c5cf38b1
No related branches found
No related tags found
1 merge request
!436
Introduce Nox for Local and CI Test Automation. Start Writing a Contributors Guide.
Pipeline
#71838
failed
5 months ago
Stage: Code Quality
Stage: Unit Tests
Stage: legacy_test
Stage: docs
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
.gitlab-ci.yml
+13
-20
13 additions, 20 deletions
.gitlab-ci.yml
noxfile.py
+79
-0
79 additions, 0 deletions
noxfile.py
pyproject.toml
+6
-1
6 additions, 1 deletion
pyproject.toml
with
101 additions
and
21 deletions
.gitignore
+
3
−
0
View file @
1f5a7b44
__pycache__
.ipynb_checkpoints
.coverage*
coverage.xml
*.pyc
*.vti
/build
...
...
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
13
−
20
View file @
1f5a7b44
...
...
@@ -255,30 +255,25 @@ pycodegen-integration:
# -------------------- Code Quality ---------------------------------------------------------------------
flake8-lint
:
.qa-base
:
stage
:
"
Code
Quality"
image
:
i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine
needs
:
[]
except
:
variables
:
-
$ENABLE_NIGHTLY_BUILDS
image
:
i10git.cs.fau.de:5005/pycodegen/pycodegen/full
script
:
-
flake8 src/pystencils
tags
:
-
docker
mypy-typecheck
:
stage
:
"
Code
Quality"
except
:
variables
:
-
$ENABLE_NIGHTLY_BUILDS
image
:
i10git.cs.fau.de:5005/pycodegen/pycodegen/full
before_script
:
-
pip install -e .[tests]
lint
:
extends
:
.qa-base
script
:
-
mypy src/pystencils
tags
:
-
docker
-
nox --session lint
typecheck
:
extends
:
.qa-base
script
:
-
nox --session typecheck
# -------------------- Unit Tests ---------------------------------------------------------------------
...
...
@@ -286,18 +281,16 @@ mypy-typecheck:
tests-and-coverage
:
stage
:
"
Unit
Tests"
needs
:
[]
image
:
i10git.cs.fau.de:5005/pycodegen/pycodegen/
full:cupy12.3
image
:
i10git.cs.fau.de:5005/pycodegen/pycodegen/
nox:ubuntu24.04-cuda12
before_script
:
-
pip install -e .[tests]
script
:
-
env
-
pip list
-
export NUM_CORES=$(nproc --all)
-
mkdir -p ~/.config/matplotlib
-
echo "backend:template" > ~/.config/matplotlib/matplotlibrc
-
mkdir public
-
pytest -v -n $NUM_CORES --cov-report html --cov-report xml --cov-report term --cov=. -m "not longrun" --html test-report/index.html --junitxml=report.xml
-
python -m coverage xml
-
nox --session "testsuite(cupy12)"
tags
:
-
docker
-
cuda11
...
...
This diff is collapsed.
Click to expand it.
noxfile.py
0 → 100644
+
79
−
0
View file @
1f5a7b44
from
__future__
import
annotations
from
typing
import
Sequence
import
os
import
nox
import
subprocess
nox
.
options
.
sessions
=
[
"
lint
"
,
"
typecheck
"
,
"
testsuite
"
]
def
get_cuda_version
()
->
None
|
tuple
[
int
,
...]:
smi_args
=
[
"
nvidia-smi
"
,
"
--version
"
]
try
:
result
=
subprocess
.
run
(
smi_args
,
capture_output
=
True
)
except
FileNotFoundError
:
return
None
smi_output
=
str
(
result
.
stdout
).
splitlines
()
cuda_version
=
smi_output
[
-
1
].
split
(
"
:
"
)[
1
].
strip
()
return
tuple
(
int
(
v
)
for
v
in
cuda_version
.
split
(
"
.
"
))
def
editable_install
(
session
:
nox
.
Session
,
opts
:
Sequence
[
str
]
=
()):
if
opts
:
opts_str
=
"
[
"
+
"
,
"
.
join
(
opts
)
+
"
]
"
else
:
opts_str
=
""
session
.
install
(
"
-e
"
,
f
"
.
{
opts_str
}
"
)
@nox.session
(
python
=
"
3.10
"
,
tags
=
[
"
qa
"
,
"
code-quality
"
])
def
lint
(
session
:
nox
.
Session
):
"""
Lint code using flake8
"""
session
.
install
(
"
flake8
"
)
session
.
run
(
"
flake8
"
,
"
src/pystencils
"
)
@nox.session
(
python
=
"
3.10
"
,
tags
=
[
"
qa
"
,
"
code-quality
"
])
def
typecheck
(
session
:
nox
.
Session
):
"""
Run MyPy for static type checking
"""
editable_install
(
session
)
session
.
install
(
"
mypy
"
)
session
.
run
(
"
mypy
"
,
"
src/pystencils
"
)
@nox.parametrize
(
"
cupy_version
"
,
[
None
,
"
12
"
,
"
13
"
],
ids
=
[
"
cpu
"
,
"
cupy12
"
,
"
cupy13
"
]
)
@nox.session
(
python
=
"
3.10
"
,
tags
=
[
"
test
"
])
def
testsuite
(
session
:
nox
.
Session
,
cupy_version
:
str
|
None
):
if
cupy_version
is
not
None
:
cuda_version
=
get_cuda_version
()
if
cuda_version
is
None
or
cuda_version
[
0
]
<
11
:
session
.
skip
(
"
No compatible installation of CUDA found - Need at least CUDA 11
"
)
cuda_major
=
cuda_version
[
0
]
cupy_package
=
f
"
cupy-cuda
{
cuda_major
}
==
{
cupy_version
}
"
session
.
install
(
cupy_package
)
editable_install
(
session
,
[
"
alltrafos
"
,
"
use_cython
"
,
"
interactive
"
,
"
testsuite
"
])
num_cores
=
os
.
cpu_count
()
session
.
run
(
"
pytest
"
,
"
-v
"
,
"
-n
"
,
str
(
num_cores
),
"
--cov-report=term
"
,
"
--cov=.
"
,
"
-m
"
,
"
not longrun
"
,
"
--html
"
,
"
test-report/index.html
"
,
"
--junitxml=report.xml
"
)
session
.
run
(
"
coverage
"
,
"
html
"
)
session
.
run
(
"
coverage
"
,
"
xml
"
)
This diff is collapsed.
Click to expand it.
pyproject.toml
+
6
−
1
View file @
1f5a7b44
...
...
@@ -44,6 +44,11 @@ interactive = [
use_cython
=
[
'Cython'
]
dev
=
[
"flake8"
,
"mypy"
,
"black"
,
]
doc
=
[
'sphinx'
,
'pydata-sphinx-theme=
=
0.15
.
4
',
...
...
@@ -54,7 +59,7 @@ doc = [
'sphinx_design'
,
'myst-nb'
]
tests
=
[
tests
uite
=
[
'pytest'
,
'pytest-cov'
,
'pytest-html'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment