Skip to content

Commit a5261c1

Browse files
author
Gerit Wagner
committed
add dist-smoke-test
1 parent d98a610 commit a5261c1

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: dist-smoke-test
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ["main"]
7+
tags: ["v*"]
8+
pull_request:
9+
paths:
10+
- "pyproject.toml"
11+
- "search_query/**"
12+
- ".github/workflows/dist-smoke-test.yml"
13+
14+
jobs:
15+
dist-smoke-test:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.10", "3.12"]
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set up uv
27+
uses: astral-sh/setup-uv@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
enable-cache: true
31+
32+
- name: Build dists (wheel + sdist)
33+
run: |
34+
uv pip install build
35+
uv run -m build
36+
37+
- name: Inspect artifacts (files present)
38+
run: |
39+
# wheel must contain the package dir
40+
uv run python - <<'PY'
41+
import glob, zipfile
42+
whls = glob.glob("dist/*.whl")
43+
assert whls, "No wheel found in dist/"
44+
whl = whls[0]
45+
z = zipfile.ZipFile(whl)
46+
names = z.namelist()
47+
assert any(n.startswith("search_query/") for n in names), f"wheel missing search_query/: {whl}"
48+
print("OK: wheel contains package files")
49+
PY
50+
51+
# sdist must contain the package dir too (path may be prefixed with project name/version)
52+
uv run python - <<'PY'
53+
import glob, tarfile
54+
tgzs = glob.glob("dist/*.tar.gz")
55+
assert tgzs, "No sdist found in dist/"
56+
tgz = tgzs[0]
57+
t = tarfile.open(tgz, "r:gz")
58+
names = t.getnames()
59+
assert any("/search_query/" in n or n.endswith("/search_query") for n in names), f"sdist missing search_query/: {tgz}"
60+
print("OK: sdist contains package files")
61+
PY
62+
63+
- name: Install from wheel and import (isolated venv)
64+
run: |
65+
uv venv .venv-wheel
66+
VPY="$PWD/.venv-wheel/bin/python"
67+
"$VPY" -m ensurepip --upgrade
68+
"$VPY" -m pip install --upgrade pip
69+
"$VPY" -m pip install dist/*.whl
70+
"$VPY" -c "import search_query; print('import OK:', search_query.__file__)"
71+
"$VPY" -c "from search_query.exception import QuerySyntaxError; print('symbol OK:', QuerySyntaxError)"
72+
73+
- name: Install from sdist and import (isolated venv)
74+
run: |
75+
uv venv .venv-sdist
76+
VPY="$PWD/.venv-sdist/bin/python"
77+
"$VPY" -m ensurepip --upgrade
78+
"$VPY" -m pip install --upgrade pip
79+
"$VPY" -m pip install dist/*.tar.gz
80+
"$VPY" -c "import search_query; print('import OK:', search_query.__file__)"
81+
"$VPY" -c "from search_query.exception import QuerySyntaxError; print('symbol OK:', QuerySyntaxError)"

0 commit comments

Comments
 (0)