Skip to content

Commit 55757ef

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

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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 --upgrade pip
39+
uv pip install build
40+
uv run -m build
41+
42+
- name: Inspect artifacts (files present)
43+
run: |
44+
# wheel must contain the package dir
45+
uv run python - <<'PY'
46+
import glob, zipfile
47+
whls = glob.glob("dist/*.whl")
48+
assert whls, "No wheel found in dist/"
49+
whl = whls[0]
50+
z = zipfile.ZipFile(whl)
51+
names = z.namelist()
52+
assert any(n.startswith("search_query/") for n in names), f"wheel missing search_query/: {whl}"
53+
print("OK: wheel contains package files")
54+
PY
55+
56+
# sdist must contain the package dir too (path may be prefixed with project name/version)
57+
uv run python - <<'PY'
58+
import glob, tarfile
59+
tgzs = glob.glob("dist/*.tar.gz")
60+
assert tgzs, "No sdist found in dist/"
61+
tgz = tgzs[0]
62+
t = tarfile.open(tgz, "r:gz")
63+
names = t.getnames()
64+
assert any("/search_query/" in n or n.endswith("/search_query") for n in names), f"sdist missing search_query/: {tgz}"
65+
print("OK: sdist contains package files")
66+
PY
67+
68+
- name: Install from wheel and import
69+
run: |
70+
uv venv .venv-wheel
71+
. .venv-wheel/bin/activate
72+
python -m pip install --upgrade pip
73+
python -m pip install dist/*.whl
74+
python -c "import search_query; print('import OK:', search_query.__file__)"
75+
python -c "from search_query.exception import QuerySyntaxError; print('symbol OK:', QuerySyntaxError)"
76+
77+
- name: Install from sdist and import
78+
run: |
79+
uv venv .venv-sdist
80+
. .venv-sdist/bin/activate
81+
python -m pip install --upgrade pip
82+
python -m pip install dist/*.tar.gz
83+
python -c "import search_query; print('import OK:', search_query.__file__)"
84+
python -c "from search_query.exception import QuerySyntaxError; print('symbol OK:', QuerySyntaxError)"

0 commit comments

Comments
 (0)