Skip to content

Commit 157e780

Browse files
committed
ci: print out packages, test on CMake 3.20
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 9342bde commit 157e780

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
pipx run nox -s pylint
3535
3636
checks:
37-
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
37+
name: 🐍 ${{ matrix.python-version }} on ${{ matrix.runs-on }} ${{ matrix.cmake }}
3838
runs-on: ${{ matrix.runs-on }}
3939
needs: [pre-commit]
4040
strategy:
@@ -46,6 +46,9 @@ jobs:
4646
include:
4747
- python-version: pypy-3.10
4848
runs-on: ubuntu-latest
49+
- python-version: "3.9"
50+
runs-on: ubuntu-latest
51+
cmake: "3.20.x"
4952

5053
steps:
5154
- uses: actions/checkout@v4
@@ -57,6 +60,11 @@ jobs:
5760
python-version: ${{ matrix.python-version }}
5861
allow-prereleases: true
5962

63+
- uses: jwlawson/actions-setup-cmake@v2
64+
if: matrix.cmake != ''
65+
with:
66+
cmake-version: ${{ matrix.cmake }}
67+
6068
- uses: yezz123/setup-uv@v4
6169

6270
- name: Install package

tests/conftest.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import sys
2+
import shutil
3+
import subprocess
4+
5+
6+
import importlib.metadata
7+
8+
9+
def _get_program(name: str) -> str:
10+
res = shutil.which(name)
11+
if res is None:
12+
return f"No {name} executable found on PATH"
13+
result = subprocess.run([res, "--version"], check=True, text=True, capture_output=True)
14+
version = result.stdout.splitlines()[0]
15+
return f"{res}: {version}"
16+
17+
def pytest_report_header() -> str:
18+
interesting_packages = {
19+
"cmake",
20+
"ninja",
21+
"packaging",
22+
"pip",
23+
"scikit-build-core",
24+
}
25+
valid = []
26+
for package in interesting_packages:
27+
try:
28+
version = importlib.metadata.version(package)
29+
except ModuleNotFoundError:
30+
continue
31+
valid.append(f"{package}=={version}")
32+
reqs = " ".join(sorted(valid))
33+
pkg_line = f"installed packages of interest: {reqs}"
34+
prog_lines = [_get_program(n) for n in ("cmake3", "cmake", "ninja")]
35+
36+
return "\n".join([pkg_line, *prog_lines])

0 commit comments

Comments
 (0)