feat: Migrate to uv. #106
Workflow file for this run
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
name: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
UV_SYSTEM_PYTHON: 1 | |
UV_VERSION: 0.7.5 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "$UV_VERSION" | |
enable-cache: true | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install the project | |
run: uv sync --locked --all-extras --group dev | |
- name: Lint | |
run: | |
mypy openapi_pydantic tests | |
ruff check openapi_pydantic tests | |
ruff format openapi_pydantic tests --check | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
pydantic-version: ['pydantic-v1', 'pydantic-v2'] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "$UV_VERSION" | |
enable-cache: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install the project | |
run: uv sync --locked --all-extras --group test | |
- name: Install Pydantic v1 | |
if: matrix.pydantic-version == 'pydantic-v1' | |
run: uv pip install "pydantic>=1.10.0,<2.0.0" | |
- name: Install Pydantic v2 | |
if: matrix.pydantic-version == 'pydantic-v2' | |
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0" | |
- run: mkdir coverage | |
- name: Test | |
run: coverage run -m pytest tests | |
env: | |
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} | |
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} | |
- name: Store coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }} | |
path: coverage | |
include-hidden-files: true | |
coverage: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "$UV_VERSION" | |
enable-cache: true | |
- name: Install Dependencies | |
run: uv pip install coverage | |
- name: Get coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage-* | |
path: coverage | |
merge-multiple: true | |
- run: ls -la coverage | |
- run: coverage combine coverage | |
- run: coverage report | |
- run: coverage html --title "Coverage for ${{ github.sha }}" | |
- name: Store coverage HTML | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-html | |
path: htmlcov | |
include-hidden-files: true |