Turnkey-LLM post release fixes #538
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Python distributions to PyPI | |
on: | |
push: | |
branches: ["main", "canary", "refresh"] | |
tags: | |
- v* | |
- RC* | |
pull_request: | |
branches: ["main", "canary", "refresh"] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python distributions to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniconda-version: "latest" | |
activate-environment: tkml | |
python-version: ${{ matrix.python-version }} | |
- name: Install pypa/build | |
run: >- | |
python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: | | |
python -m build --sdist --wheel --outdir dist/ . | |
version=$(python setup.py --version) | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Test wheel | |
shell: bash -el {0} | |
run: | | |
python -m pip install --upgrade pip | |
pip install "dist/turnkeyml-${{ env.VERSION }}-py3-none-any.whl" | |
models=$(turnkey models-location --quiet) | |
turnkey -i $models/selftest/linear.py discover export-pytorch | |
# Test LLMs as well | |
pip install "dist/turnkeyml-${{ env.VERSION }}-py3-none-any.whl[llm]" | |
lemonade -i facebook/opt-125m huggingface-load llm-prompt -p "Hello, my thoughts are" | |
- name: Publish distribution package to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Publish distribution package to Test PyPI | |
if: startsWith(github.ref, 'refs/tags/RC') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ |