Skip to content

Commit

Permalink
[Release] Add smoke test of wheels (#813)
Browse files Browse the repository at this point in the history
Add some basic testing of the wheels built during the release workflow
  • Loading branch information
riedgar-ms authored May 10, 2024
1 parent c7bba78 commit 07955f8
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ jobs:
name: sdist_files
path: dist/*.tar.gz

publish_wheels:
permissions:
id-token: write
name: Publish wheels on pypi

assemble_wheels:
name: Combine wheels
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
Expand All @@ -134,6 +133,42 @@ jobs:
path: ./dist/*
name: collected_dist_files

test_wheels:
name: Test Wheels
needs: [assemble_wheels]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-12, macos-latest]
python-version: ["3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/download-artifact@v4
with:
name: collected_dist_files
path: wheelhouse
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install guidance -f ./wheelhouse/
name: Install guidance from wheels
- run: pip install transformers torch
name: Other installs
- 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')"
name: Run smoke test

publish_wheels:
permissions:
id-token: write
name: Publish wheels on pypi
needs: [test_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: collected_dist_files
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags')
Expand Down

0 comments on commit 07955f8

Please sign in to comment.