Merge pull request #286 from manparvesh/v2 #9
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: CI | |
on: | |
push: | |
branches: | |
- v2 | |
pull_request: | |
branches: | |
- v2 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.9", "3.10", "3.11", "3.12" ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Configure Poetry to use the local cache | |
run: poetry config virtualenvs.in-project false | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-ansi | |
- name: Run Tests | |
run: poetry run pytest | |
# Publish to PyPI | |
- name: Configure pypi api token | |
if: github.ref == 'refs/heads/v2' && github.event_name == 'push' | |
run: poetry config pypi-token.pypi $PYPI_API_TOKEN | |
env: | |
$PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Build the package | |
if: github.ref == 'refs/heads/v2' && github.event_name == 'push' | |
run: poetry build | |
- name: Publish to PyPI | |
if: github.ref == 'refs/heads/v2' && github.event_name == 'push' | |
run: poetry publish |