Skip to content

Commit 07955f8

Browse files
authored
[Release] Add smoke test of wheels (#813)
Add some basic testing of the wheels built during the release workflow
1 parent c7bba78 commit 07955f8

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

.github/workflows/pypi_upload.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,9 @@ jobs:
111111
name: sdist_files
112112
path: dist/*.tar.gz
113113

114-
publish_wheels:
115-
permissions:
116-
id-token: write
117-
name: Publish wheels on pypi
114+
115+
assemble_wheels:
116+
name: Combine wheels
118117
needs: [build_wheels, build_sdist]
119118
runs-on: ubuntu-latest
120119
steps:
@@ -134,6 +133,42 @@ jobs:
134133
path: ./dist/*
135134
name: collected_dist_files
136135

136+
test_wheels:
137+
name: Test Wheels
138+
needs: [assemble_wheels]
139+
strategy:
140+
matrix:
141+
os: [ubuntu-latest, windows-latest, macos-12, macos-latest]
142+
python-version: ["3.11", "3.12"]
143+
runs-on: ${{ matrix.os }}
144+
steps:
145+
- uses: actions/download-artifact@v4
146+
with:
147+
name: collected_dist_files
148+
path: wheelhouse
149+
- name: Set up Python ${{ matrix.python-version }}
150+
uses: actions/setup-python@v5
151+
with:
152+
python-version: ${{ matrix.python-version }}
153+
- run: pip install guidance -f ./wheelhouse/
154+
name: Install guidance from wheels
155+
- run: pip install transformers torch
156+
name: Other installs
157+
- run: python -c "import guidance; lm = guidance.models.Transformers('gpt2'); lm += '1,2,3,4,5,' + guidance.gen('num', max_tokens=5, temperature=0); print(f'\n{str(lm)=}\n'); assert lm['num'].startswith('6')"
158+
name: Run smoke test
159+
160+
publish_wheels:
161+
permissions:
162+
id-token: write
163+
name: Publish wheels on pypi
164+
needs: [test_wheels]
165+
runs-on: ubuntu-latest
166+
steps:
167+
- uses: actions/download-artifact@v4
168+
with:
169+
name: collected_dist_files
170+
path: dist
171+
137172
- name: Publish package to PyPI
138173
uses: pypa/gh-action-pypi-publish@release/v1
139174
if: startsWith(github.ref, 'refs/tags')

0 commit comments

Comments
 (0)