Migrate mypy to pyright #3158
This file contains 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: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
test: | |
name: >- | |
Test ${{ matrix.py }} | |
${{ matrix.os == 'windows-latest' && 'Windows' || (matrix.os == 'macos-latest' && 'macOS' || 'Ubuntu') }} | |
${{ matrix.isort != '' && format('isort={0} ', matrix.isort) || ''}} | |
${{ matrix.black != '' && format('black={0} ', matrix.black) || ''}} | |
${{ matrix.pydantic != '' && format('pydantic={0} ', matrix.pydantic) || ''}} | |
strategy: | |
fail-fast: false | |
matrix: | |
py: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"] | |
os: [ubuntu-24.04, windows-latest, macos-latest] | |
isort: [''] # '' mean not set, aka use the default | |
black: [''] | |
pydantic: [''] | |
include: | |
- py: 3.12 | |
black: 24.1.0 | |
- py: 3.12 | |
black: 23.12.1 | |
- py: 3.12 | |
black: 22.1.0 | |
- py: 3.9 | |
black: 19.10b0 | |
pydantic: 1.8.2 | |
- py: 3.8 | |
pydantic: 1.8.2 | |
- py: 3.8 | |
isort: 4.3.21 | |
pydantic: 1.5.1 | |
runs-on: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os }} | |
env: | |
OS: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
- name: Install tox | |
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv | |
- name: Setup Python test environment | |
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }} | |
- name: Install custom package versions | |
if: ${{ matrix.isort != '' || matrix.black != '' || matrix.pydantic != ''}} | |
run: >- | |
tox exec --no-list-dependencies --skip-pkg-install -e ${{ matrix.py }} -- uv pip install | |
${{ matrix.isort != '' && format('isort=={0} ', matrix.isort) || ''}} | |
${{ matrix.black != '' && format('black=={0} ', matrix.black) || ''}} | |
${{ matrix.pydantic != '' && format('pydantic=={0} ', matrix.pydantic) || ''}} | |
- name: Run test suite | |
run: tox run --skip-pkg-install -e ${{ matrix.py }} | |
env: | |
COVERAGE_XML: ./coverage.xml | |
- name: Upload coverage to Codecov | |
if: matrix.os == 'ubuntu-24.04' || matrix.os == '' | |
uses: codecov/codecov-action@v5 | |
with: | |
flags: unittests | |
files: ./coverage.xml | |
fail_ci_if_error: true | |
env_vars: OS,PY,ISORT | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |