Multiple enhancements: #153
This file contains hidden or 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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Package testing | |
| on: | |
| push: | |
| branches: [ "master", "dev", "feature/*", "feat/*" ] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| build-latest: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5.4.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: ${{ (matrix.python-version == '3.7' && '1.5.1' || (matrix.python-version == '3.8' && '1.7.1' || 'latest')) }} | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| installer-parallel: true | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction --no-root | |
| - name: Install project | |
| run: poetry install --no-interaction | |
| - name: Verify pytest installation | |
| run: poetry run python -c "import pytest; print('pytest version:', pytest.__version__)" | |
| - name: Lint with flake8 | |
| if: matrix.python-version != '3.7' | |
| run: | | |
| make lint | |
| - name: Check code format | |
| if: matrix.python-version != '3.7' | |
| run: | | |
| make format-check | |
| - name: Test with pytest | |
| run: | | |
| make test | |
| - name: Run examples | |
| run: | | |
| make run-examples | |
| - name: Build package | |
| run: make build |