Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ env:
UV_PYTHON: "3.11"

jobs:
wheel:
name: Unit tests (installed wheel)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
version: "latest"
- run: uv python install 3.11
- name: Build and install the candidate wheel
run: |
uv build --wheel --out-dir "$RUNNER_TEMP/wheel-dist"
sha256sum "$RUNNER_TEMP"/wheel-dist/*.whl
uv venv --python 3.11 "$RUNNER_TEMP/wheel-env"
wheel=("$RUNNER_TEMP"/wheel-dist/*.whl)
test "${#wheel[@]}" -eq 1
uv pip install --python "$RUNNER_TEMP/wheel-env/bin/python" "${wheel[0]}[dev,all]"
- name: Run the unit suite against the installed wheel
run: |
"$RUNNER_TEMP/wheel-env/bin/python" -I scripts/check_wheel.py

lint:
name: Lint
runs-on: ubuntu-latest
Expand Down
31 changes: 31 additions & 0 deletions scripts/check_wheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Run the unit suite against the wheel installed in this environment, not the checkout."""

import sys
from importlib.metadata import version
from pathlib import Path

import pytest

import arc_client

repo = Path(__file__).resolve().parents[1]
package = Path(arc_client.__file__).resolve().parent
assert repo not in package.parents, f"Imported checkout instead of wheel: {package}"
assert Path(sys.prefix).resolve() in package.parents, f"Package outside environment: {package}"
print(f"arc-tsdb-client {version('arc-tsdb-client')}: {package}", flush=True)


def check_imports():
for name, module in tuple(sys.modules.items()):
if name == "arc_client" or name.startswith("arc_client."):
origin = Path(module.__file__).resolve()
assert package in origin.parents, f"Source import during wheel tests: {name}: {origin}"


check_imports()
# The whole unit suite, so a module or data file the wheel leaves out fails
# here whichever feature it belongs to. Install with [dev,all]: without pandas
# and polars their tests skip instead of running.
result = pytest.main(["--import-mode=importlib", "-o", "addopts=", "-q", str(repo / "tests/unit")])
check_imports()
sys.exit(result)
Loading