Skip to content

Commit e42e620

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

File tree

1 file changed

+85
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)