Skip to content

Commit 6d1472e

Browse files
committed
move the tests to the ubuntu runner
1 parent 1b84273 commit 6d1472e

File tree

7 files changed

+77
-123
lines changed

7 files changed

+77
-123
lines changed

.github/workflows/cibuildwheel-impl/action.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,10 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11-
- name: Install system dependencies
12-
shell: bash
13-
run: |
14-
sudo apt install -y binutils cmake dpkg-dev g++ gcc libssl-dev git libx11-dev \
15-
libxext-dev libxft-dev libxpm-dev libtbb-dev libvdt-dev libgif-dev libfftw3-dev
16-
1711
- name: Build wheel
1812
uses: pypa/cibuildwheel@v3.0.1
1913
env:
20-
PIP_NO_CACHE_DIR: "1"
2114
CIBW_BUILD: ${{ inputs.build-tag }}
22-
CIBW_TEST_REQUIRES: "-r test_tutorials/requirements.txt"
23-
CIBW_TEST_SOURCES: "test_tutorials"
24-
CIBW_TEST_COMMAND: "pytest -vv -rF --show-capture=all test_tutorials"
2515

2616
- name: Upload wheel
2717
uses: actions/upload-artifact@v4

.github/workflows/python_wheel_build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,48 @@ jobs:
3535
with:
3636
build-tag: ${{ matrix.target }}
3737

38+
test-tutorials:
39+
needs: build-wheels
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install required system packages
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get install -y libfftw3-dev
52+
53+
- name: Download produced wheels
54+
uses: actions/download-artifact@v4
55+
with:
56+
path: wheels
57+
merge-multiple: true
58+
59+
- name: Setup Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
64+
- name: Install produced wheel
65+
run: |
66+
ls -R wheels
67+
PY_VER=$(python -c "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
68+
WHEEL=$(ls wheels/*${PY_VER}*.whl | head -n 1)
69+
echo "Python version: ${PY_VER}, installing wheel: ${WHEEL}"
70+
pip install "$WHEEL"
71+
72+
- name: Install tutorials dependencies
73+
run: |
74+
python -m pip install -r test_tutorials/requirements.txt
75+
76+
- name: Run tutorials
77+
run: |
78+
pytest -vv -rF --show-capture=all test_tutorials
79+
3880
create-and-upload-wheel-registry:
3981
if: github.event_name != 'pull_request' # The secrets are not available in PR
4082
needs: build-wheels

test_tutorials/requirements.txt

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,19 @@
1-
# ROOT requirements for third-party Python packages
1+
# ROOT requirements for third-party Python packages used to run tutorials
22

33
# PyROOT: Interoperability with numpy arrays
44
numpy
55
pandas
66

7-
# TMVA: SOFIE
8-
# dm-sonnet # used for GNNs
9-
# graph_nets
10-
# onnx
11-
12-
# TMVA: PyMVA interfaces
13-
# scikit-learn
14-
# tensorflow ; python_version < "3.13" # TensorFlow doesn't support Python 3.13 yet
15-
# torch
16-
# xgboost
17-
187
# PyROOT: ROOT.Numba.Declare decorator
198
numba>=0.48
209
cffi>=1.9.1
2110

22-
# Notebooks: ROOT C++ kernel
23-
# IPython
24-
# jupyter
25-
# metakernel>=0.20.0
26-
# notebook>=4.4.1
27-
28-
# Distributed RDataFrame
29-
# pyspark>=2.4 # Spark backend
30-
# dask>=2022.08.1 # Dask backend
31-
# distributed>=2022.08.1 # Dask backend
32-
33-
# JsMVA: Jupyter notebook magic for TMVA
34-
# ipywidgets
35-
3611
# Unified Histogram Interface (UHI)
3712
uhi
3813
matplotlib
3914
mplhep
4015

41-
# For testing
42-
# nbconvert>=7.4.0
16+
# Other
4317
pytest
44-
# setuptools
45-
4618
scikit-learn
47-
48-
# Look for CPU-only versions of PyTorch to avoid pulling CUDA in the CI docker images.
49-
# -f https://download.pytorch.org/whl/cpu/torch_stable.html
19+
xgboost

test_tutorials/test_tutorials.py

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
1+
import os
2+
import pathlib
3+
import signal
14
import subprocess
25
import sys
3-
import pathlib
4-
import ROOT
5-
import os
6+
67
import pytest
7-
import signal
8+
import ROOT
89

910
ROOT.gROOT.SetBatch(True)
1011

1112
tutorial_dir = pathlib.Path(str(ROOT.gROOT.GetTutorialDir()))
1213

13-
subdirs = [
14-
"analysis/dataframe",
15-
"analysis/tree",
16-
"hist",
17-
"io/ntuple",
18-
"roofit/roofit"
19-
]
14+
subdirs = ["analysis/dataframe", "analysis/tree", "hist", "io/ntuple", "roofit/roofit"]
15+
16+
SKIP_TUTORIALS = {
17+
"rf503_wspaceread.py",
18+
"rf615_simulation_based_inference.py",
19+
"ntpl004_dimuon.C",
20+
"ntpl008_import.C",
21+
# skip distributed RDataFrame tutorials for now
22+
"distrdf",
23+
}
2024

2125
# ----------------------
2226
# Python tutorials tests
2327
# ----------------------
2428
py_tutorials = []
2529
for sub in subdirs:
2630
sub_path = tutorial_dir / sub
27-
# py_tutorials.extend(sub_path.rglob("*.py"))
2831
for f in sub_path.rglob("*.py"):
29-
# skip distrdf tutorials for now
30-
if "distrdf" in f.name:
32+
if any(skip in f.name for skip in SKIP_TUTORIALS):
33+
print("Skipping Python tutorial:", f)
3134
continue
3235
py_tutorials.append(f)
3336

37+
3438
def test_tutorials_are_detected():
3539
assert len(py_tutorials) > 0
3640

41+
3742
@pytest.mark.parametrize("tutorial", py_tutorials, ids=lambda p: p.name)
3843
def test_tutorial(tutorial):
3944
env = dict(**os.environ)
@@ -46,6 +51,8 @@ def test_tutorial(tutorial):
4651
check=True,
4752
env=env,
4853
timeout=60,
54+
capture_output=True,
55+
text=True,
4956
)
5057
print("Test stderr:", result.stderr)
5158
except subprocess.TimeoutExpired:
@@ -56,17 +63,24 @@ def test_tutorial(tutorial):
5663
pytest.skip(f"Skipping {tutorial.name} (requires user input)")
5764
raise
5865

66+
5967
# ----------------------
6068
# C++ tutorials tests
6169
# ----------------------
6270
cpp_tutorials = []
6371
for sub in subdirs:
6472
sub_path = tutorial_dir / sub
65-
cpp_tutorials.extend(sub_path.rglob("*.C"))
73+
for f in sub_path.rglob("*.C"):
74+
if any(skip in f.name for skip in SKIP_TUTORIALS):
75+
print("Skipping C++ tutorial:", f)
76+
continue
77+
cpp_tutorials.append(f)
78+
6679

6780
def test_cpp_tutorials_are_detected():
6881
assert len(cpp_tutorials) > 0
6982

83+
7084
@pytest.mark.parametrize("tutorial", cpp_tutorials, ids=lambda p: p.name)
7185
def test_cpp_tutorial(tutorial):
7286
try:
@@ -75,13 +89,14 @@ def test_cpp_tutorial(tutorial):
7589
check=True,
7690
timeout=60,
7791
capture_output=True,
78-
text=True
92+
text=True,
7993
)
94+
print("Test stderr:", result.stderr)
8095
except subprocess.TimeoutExpired:
8196
pytest.skip(f"Tutorial {tutorial} timed out")
8297
except subprocess.CalledProcessError as e:
8398
if e.returncode == -signal.SIGILL or e.returncode == 132:
8499
pytest.fail(f"Failing {tutorial.name} (illegal instruction on this platform)")
85100
elif "EOFError" in e.stderr:
86101
pytest.skip(f"Skipping {tutorial.name} (requires user input)")
87-
raise
102+
raise

tutorials/analysis/dataframe/df000_simple_dbg1.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

tutorials/analysis/dataframe/df000_simple_dbg2.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

tutorials/analysis/dataframe/df000_simple_dbg3.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)