Skip to content

Fix #94 fastapi compat #86

Fix #94 fastapi compat

Fix #94 fastapi compat #86

Workflow file for this run

# Regular tests
#
# Use this to ensure your tests are passing on every push and PR (skipped on
# pushes which only affect documentation).
#
# You should make sure you run jobs on at least the *oldest* and the *newest*
# versions of python that your codebase is intended to support.
name: tests
on:
push:
branches:
- main
- dev
pull_request:
jobs:
test:
timeout-minutes: 45
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- name: Set OS Environment Variables (Windows)
if: runner.os == 'Windows'
run: |
echo 'ACTIVATE_PYTHON_VENV=.venv/scripts/activate' >> $GITHUB_ENV
- name: Set OS Environment Variables (not Windows)
if: runner.os != 'Windows'
run: |
echo 'ACTIVATE_PYTHON_VENV=.venv/bin/activate' >> $GITHUB_ENV
- name: Check out repository
uses: actions/checkout@v4
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cppcheck clang-format
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cppcheck
brew install clang-format
- name: Install system dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install cppcheck
choco install llvm --yes # This includes clang-format
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Install dependencies
run: |
uv sync --group dev
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
# - name: Pre-commit run
# run: |
# source ${{ env.ACTIVATE_PYTHON_VENV }}
# pre-commit run --show-diff-on-failure --color=always --all-files
- name: Check tests folder existence
id: check_test_files
uses: andstor/file-existence-action@v3
with:
files: "tests"
- name: Run tests
if: steps.check_test_files.outputs.files_exists == 'true'
env:
PYTHONWARNINGS: ignore
run: |
uv run python -m pytest tests/ -vv -s
- name: Run fastapi compatibility tests
if: steps.check_test_files.outputs.files_exists == 'true'
env:
PYTHONWARNINGS: ignore
run: |
uv run nox -s test-compat-fastapi
#----------------------------------------------
# make sure docs build
#----------------------------------------------
- name: Build HTML docs
run: |
uv sync --group docs
uv run mkdocs build
# - name: Upload coverage to Codecov
# if: steps.check_test_files.outputs.files_exists == 'true'
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# flags: unittests
# env_vars: OS,PYTHON
# name: Python ${{ matrix.python-version }} on ${{ runner.os }}