Skip to content

Fix publish workflow #3

Fix publish workflow

Fix publish workflow #3

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python library with poetry
on:
push:
paths:
- 'mongospecs/**'
- 'tests/**'
- 'examples/**'
- 'pyproject.toml'
permissions:
contents: read
jobs:
build:
strategy:
matrix:
extras: [true] # false
python-version: [ "3.11", "3.10", "3.9" ]
os: [ubuntu-latest] # windows-latest, macos-latest
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.extras }}
- name: Install dependencies
run: poetry install --no-interaction --no-root
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.extras == false }}
- name: Install dependencies
run: poetry install --no-interaction --no-root --all-extras
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.extras }}
- name: Install library
run: poetry install --no-interaction
if: ${{ matrix.extras == false }}
- name: Install library
run: poetry install --no-interaction --all-extras
if: ${{ matrix.extras }}
- name: Code quality
run: |
source $VENV
poetry run make lint
- name: Test with pytest
run: |
source $VENV
poetry run make test