Merge pull request #303 from manparvesh/v2 #34
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: | |
test: | |
name: Test on all python versions | |
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: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/v2' && github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- 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: Configure pypi api token | |
run: poetry config pypi-token.pypi $PYPI_API_TOKEN | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Build the package | |
run: poetry build | |
- name: Publish to PyPI | |
run: poetry publish |