Skip to content

0.2.2

0.2.2 #85

Workflow file for this run

name: Build wheels
on:
release:
types: [published]
workflow_dispatch: # Enable manual run
inputs:
commit_id:
description: 'Branch or Commit ID (optional)'
required: false
type: string
jobs:
build_wheels:
name: Build wheel distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repo at ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build bdist
run: |
python -m pip install build
python -m build --wheel
- name: Upload bdist
uses: actions/upload-artifact@v4
with:
name: bdist_files
path: dist/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repo at ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build sdist (pep517)
run: |
python -m pip install build
python -m build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist_files
path: dist/*.tar.gz
assemble_wheels:
name: Combine wheels
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: sdist_files
path: dist
- uses: actions/download-artifact@v4
with:
name: bdist_files
path: dist
- uses: actions/upload-artifact@v4
with:
path: ./dist/*
name: collected_dist_files
test_wheels:
name: Test Wheels
needs: [assemble_wheels]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-14, 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: python -m pip install guidance -f ./wheelhouse/
name: Install guidance from wheels
- run: python -m pip install transformers torch
name: Other installs
# - run: python -c "import guidance; import transformers; lm = guidance.models.Transformers('gpt2'); lm += '1,2,3,4,5,' + guidance.gen('num', max_tokens=5, temperature=0); print(f'\n Transformers Version:{transformers.__version__}\n\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')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}