Skip to content

Commit 1877d75

Browse files
committed
Merge branch 'fixed_dependencies' into 'master'
[CI] Introduce maintenance tests to prevent regular developers from encountering pipeline errors unrelated to their merge requests See merge request ogs/ogs!5387
2 parents 293e470 + 98afb17 commit 1877d75

6 files changed

Lines changed: 4216 additions & 35 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repos:
99
exclude: "^Tests/Data/.*|^Tests/Python/res/test_docu_scripts/|^web/static|^Documentation/.vale/.*|.*\\.patch"
1010
- id: check-added-large-files
1111
args: [--maxkb 1024]
12+
exclude: "^Tests/Data/uv.lock"
1213
- id: check-merge-conflict
1314
- id: check-xml
1415
exclude: '^Tests/Data/.*\.xml'

Tests/Data/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## Notebook-based tests
2+
3+
Environment for notebook-based tests is defined in this directory's `pyproject.toml` and managed via [`uv`](https://github.com/astral-sh/uv).
4+
5+
3 dependency groups which select the used `ogs` wheel:
6+
7+
- `ogs-local`: Builds ogs locally from source
8+
- `ogs-master` Downloads latest ogs wheel from master branch (requires `--upgrade-package ogs`-parameter)
9+
- `ogs-pypi` Downloads latest ogs release from PyPI
10+
11+
```bash
12+
uv run --group ogs-local pytest
13+
14+
uv run --group ogs-master --upgrade-package ogs pytest
15+
uv run --group ogs-pypi pytest
16+
17+
uv run --group ogs-local Notebooks/testrunner.py --out /tmp Mechanics/Linear/SimpleMechanics.py
18+
```
19+
20+
`uv` automatically manages a virtual environment in `./.venv`. It locks the environment according to a `uv.lock`-file. To update the file for all packages run `uv lock --upgrade`. To update only a specific package, e.g. on `ogstools`-release run `uv lock --upgrade-package ogstools`.
21+
22+
## Regression and maintenance testing
23+
24+
| | Regression test| Maintenance test |
25+
| ------ | ------ | ------ |
26+
| OGS | **latest** | stable (tip of master) |
27+
| Environment | stable (pinned via lock-file) | **latest** |
28+
| Trigger | Merge-request | scheduled or master-build |
29+
| Role | Developer | Maintainer |
30+
31+
**latest** indicates the "object under test"
32+
33+
Environment may be:
34+
35+
- pip (from PyPI)
36+
- CPM (FindPackage, GIT_TAG / VERSION) - maintenance not implemented
37+
- Compiler version - maintenance not implemented
38+
- ...
39+
40+
When to update a "stable" an environment:
41+
42+
- MUST: Change of underlying stack (e.g. software update of `envinfX` test machines)
43+
- MUST: An MR with a change in the request environment (e.g. a new lib or a new version of an already used lib is needed)
44+
- OPTIONAL: On any other occasion (e.g. OGS release)
45+
46+
Typical workflow to update:
47+
48+
1. Trigger: Maintenance test fails
49+
2. Check latest updates of 3rd party packages and their influence (`uv lock --upgrade`)
50+
3. **MR: Quick fix**: Restrict versions in (open) dependencies, add/open ToDo
51+
4. Maintenance test succeeds (this allows other maintenance issues to be found)
52+
5. Investigation and fix of own software / report to 3rd party
53+
6. **MR: Fix** and reopen dependency

Tests/Data/pyproject.toml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[project]
2+
name = "OGS-Test-Environment"
3+
version = "0.1.0"
4+
description = "Test environment for Notebook-based tests"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
dependencies = [
8+
### nb environment ###
9+
# Use no-X11 version on Linux:
10+
"gmsh==4.13.1.dev1; platform_system == 'Linux'",
11+
"gmsh>=4.12.0; platform_system != 'Linux'",
12+
"h5py>=3.8",
13+
"heatsource-py @ git+https://github.com/joergbuchwald/heatsource_thm@bbd5bab17fc2ec228c773e087dc847e1ad5f9a4c",
14+
"ipywidgets",
15+
"jupyterlab>=3.4.8",
16+
"matplotlib>=3.6",
17+
"numpy",
18+
"ogstools==0.7.0",
19+
"pandas>=1.5",
20+
# TODO: Implement fix for PyVista 0.46 in ogstools:
21+
"pyvista[all]==0.45",
22+
"seaborn>=0.12",
23+
"VTUinterface>=0.704",
24+
### dev tools ###
25+
"gcovr==6.0",
26+
"jupytext>=1.14.5",
27+
"nbconvert>=7.16.5",
28+
"nbformat>=5.7.3",
29+
"papermill>=2.6.0",
30+
"pytest>=8.2.2",
31+
"toml>=0.10.2",
32+
]
33+
34+
# Usage:
35+
# uv run --group ogs-local pytest
36+
# uv run --group ogs-master --upgrade-package ogs pytest
37+
# uv run --group ogs-pypi --upgrade-package ogs pytest
38+
# --upgrade-package uses latest, ignoring version in lockfile
39+
[dependency-groups]
40+
ogs-local = ["ogs"]
41+
ogs-master = ["ogs>=6.5.6.dev0"] # Bump after release!
42+
ogs-pypi = ["ogs"]
43+
44+
[tool.uv]
45+
conflicts = [
46+
[
47+
{ group = "ogs-local" },
48+
{ group = "ogs-master" },
49+
{ group = "ogs-pypi" },
50+
],
51+
]
52+
53+
[tool.uv.sources]
54+
gmsh = { index = "gmsh-nox", marker = "platform_system == 'Linux'" }
55+
ogs = [
56+
{ path = "../..", group = "ogs-local" }, # builds ogs from local source
57+
{ index = "ogs-gitlab", group = "ogs-master" }, # fetches last master wheel from GitLab
58+
# ogs-pypi implicit
59+
]
60+
61+
[[tool.uv.index]]
62+
name = "gmsh-nox"
63+
url = "https://gmsh.info/python-packages-dev-nox"
64+
explicit = true
65+
66+
[[tool.uv.index]]
67+
name = "ogs-gitlab"
68+
url = "https://gitlab.opengeosys.org/api/v4/projects/120/packages/pypi/simple"
69+
explicit = true

0 commit comments

Comments
 (0)