Skip to content

Test Matrix

Test Matrix #33

Workflow file for this run

name: Test Matrix
on: [ workflow_dispatch ]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
branch: ${{ github.head_ref || github.ref_name }}
strategy:
matrix:
python_version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
dependencies: [ 'test,aiohttp,requests,httpx' ]
pydantic: [ 'v2' ]
include:
- python_version: '3.12'
dependencies: 'test,aiohttp'
pydantic: 'v2'
- python_version: '3.12'
dependencies: 'test,requests'
pydantic: 'v2'
- python_version: '3.12'
dependencies: 'test,httpx'
pydantic: 'v2'
- python_version: '3.12'
dependencies: 'test,aiohttp,requests,httpx'
pydantic: 'v1'
- python_version: '3.12'
dependencies: 'test,aiohttp,requests,httpx'
pydantic: 'no'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Restore poetry from cache
id: cache-poetry-restore
uses: actions/cache/restore@v4
with:
path: ~/.local
key: test-all/poetry/runner/${{ runner.os }}/python/${{ steps.setup-python.outputs.python-version }}
- name: Install poetry
if: steps.cache-poetry-restore.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Check poetry version
run: echo POETRY_VERSION=$(poetry --version | grep -oP '\d+.\d+.\d+') >> $GITHUB_ENV
- name: Save poetry cache
id: cache-poetry-save
uses: actions/cache/save@v4
with:
path: ~/.local
key: test-all/poetry/runner/${{ runner.os }}/python/${{ steps.setup-python.outputs.python-version }}/version/${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-interaction --no-root --with=${{ matrix.dependencies }}
- name: Install pydantic v1
if: ${{ matrix.pydantic == 'v1' }}
run: poetry run pip install pydantic===1.10.13
- name: Install pydantic v2
if: ${{ matrix.pydantic == 'v2' }}
run: poetry install --no-interaction --no-root --with=pydantic
- name: Install project
run: poetry install --no-interaction --only-root
- name: Run pytest
run: poetry run pytest