blob: 471f5ae225fc044629277c7d566859565640b084 [file] [edit]
name: Build
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
env:
LATEST_PY_VERSION: '3.14'
PYTEST_VERBOSE: 'true'
jobs:
# Run tests for each supported python version
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
[
'3.14',
'3.13',
'3.12',
'3.11',
'3.10',
'3.9',
'3.8',
'pypy3.10',
'pypy3.11',
]
fail-fast: false
services:
nginx:
image: mccutchen/go-httpbin
ports:
- 8080:8080
steps:
# Install dependencies, with caching
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install dependencies
run: |
uv python install ${{ matrix.python-version }}
uv sync --all-extras
# Start integration test databases
- uses: supercharge/mongodb-github-action@315db7fe45ac2880b7758f1933e6e5d59afd5e94
with:
mongodb-version: 5.0
- uses: supercharge/redis-github-action@ffd8939ed7e6e3b99a359b6703e53bdeb544c2a9
with:
redis-version: 6
- uses: rrainn/dynamodb-action@52f02829330b77b26c950d2ecf35bb6d881749cb
# Run tests with coverage report
- name: Run unit + integration tests
if: ${{ !contains(matrix.python-version, 'pypy') }}
run: |
uv run nox -e cov -- xml
uv run nox -e stress -- 1
# pypy tests aren't run in parallel, so too slow for integration tests
- name: Run unit tests only
if: ${{ contains(matrix.python-version, 'pypy') }}
run: uv run pytest tests/unit
# Latest python version: send coverage report to codecov
- name: 'Upload coverage report to Codecov'
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
# Run code analysis checks via pre-commit hooks
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.LATEST_PY_VERSION }}
- name: Run style checks & linting
uses: j178/prek-action@91fd7d7cf70ae1dee9f4f44e7dfa5d1073fe6623
- name: Scan dependencies for known vulnerabilities
uses: pypa/gh-action-pip-audit@v1.1.0
with:
vulnerability-service: osv
# Ignore issues with pip and setuptools versions used by the action itself
ignore-vulns: |
GHSA-4xh5-x5gv-qwph