Merge pull request #20 from MinuraPunchihewa/development #15
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: Build and Publish to PyPI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: [3.9, 3.11] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install --no-cache-dir -e .[test] | |
- name: Run unit tests | |
run: python -m unittest discover tests | |
shell: bash | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_TOKEN }} | |
source-dist: | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: build wheel | |
run: | | |
pip install wheel | |
python setup.py bdist_wheel | |
- name: create source distribution | |
run: python setup.py sdist | |
- name: upload source distribution | |
run: | | |
pip install twine | |
twine upload dist/* |