test on TestPyPi #22
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 to PyPI | |
on: | |
push: | |
branches: | |
- publish-testing | |
jobs: | |
pypi-publish: | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
environment: pypi-package | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12.2 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12.2" | |
- name: Setup dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry==2.1.1 | |
poetry install | |
- name: Build package | |
run: | | |
poetry build | |
# Install invariant package in a virtual environment for testing | |
#- name: Create virtual environment and install package | |
# run: | | |
# python -m venv venv | |
# source venv/bin/activate | |
# pip install dist/*.whl | |
# Make sure the tests pass when the package is built and installed | |
#- name: Run tests | |
# env: | |
# OPENAI_API_KEY: ${{ secrets.INVARIANT_TESTING_OPENAI_KEY }} | |
# run: | | |
# source venv/bin/activate | |
# python -m pytest invariant/tests/ | |
- name: Set TestPyPI credentials | |
run: | | |
poetry config repositories.testpypi https://test.pypi.org/legacy/ | |
poetry config pypi-token.testpypi ${{ secrets.TESTPYPI_API_TOKEN }} | |
# Publish to TestPyPI | |
- name: Publish to TestPyPI | |
run: | | |
poetry publish -r testpypi --dist-dir dist |