PyPi Package Release #95
Workflow file for this run
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
--- | |
# To trigger a package release, create a new tag in the format v.x.x.x with semantic versioning | |
name: PyPi Package Release | |
on: | |
push: | |
tags: | |
# Only run this workflow for tags that start with 'v.' (release tags) | |
- 'v*' | |
jobs: | |
test: | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
name: Test with Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements/requirements-test.txt | |
pip install wheel setuptools | |
- name: Build and install aicodebot | |
run: | | |
python setup.py sdist bdist_wheel | |
pip install dist/*.whl | |
- name: Test | |
run: | | |
aicodebot -V | |
# Python 3.9 testing fails because of an issue with vcrpy | |
# https://github.com/kevin1024/vcrpy/issues/688 | |
if [[ "${{ matrix.python-version }}" == "3.9" ]]; then | |
echo "Skipping tests for Python 3.9, running alignment instead" | |
aicodebot configure | |
aicodebot alignment | |
else | |
pytest --record-mode=new_episodes | |
fi | |
pypi_release: | |
needs: test | |
runs-on: ubuntu-latest | |
name: Publish to PyPi | |
permissions: | |
# Required for github actions to create a release | |
contents: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
cache: pip | |
- name: Build the package | |
run: | | |
pip install wheel twine setuptools | |
python setup.py sdist bdist_wheel | |
- name: Publish to PyPi | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
twine check dist/* | |
twine upload dist/* | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
generateReleaseNotes: true |