Skip to content

Python: pin pydantic to <2.10 #8101

Python: pin pydantic to <2.10

Python: pin pydantic to <2.10 #8101

name: Python Unit Tests
on:
pull_request:
branches: ["main", "feature*"]
paths:
- "python/**"
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
jobs:
python-unit-tests:
name: Python Unit Tests
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
experimental: [false]
# include:
# - python-version: "3.13"
# os: "ubuntu-latest"
# experimental: true
# - python-version: "3.13t"
# os: "ubuntu-latest"
# experimental: true
# gil: 0
# - python-version: "3.13t"
# os: "ubuntu-latest"
# experimental: true
# gil: 1
env:
UV_PYTHON: ${{ matrix.python-version }}
permissions:
contents: write
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras --dev
- name: Test with pytest
env:
PYTHON_GIL: ${{ matrix.gil }}
run: uv run --frozen pytest --junitxml=pytest.xml ./tests/unit
- name: Surface failing tests
if: ${{ !matrix.experimental }}
uses: pmeier/pytest-results-action@main
with:
path: python/pytest.xml
summary: true
display-options: fEX
fail-on-empty: true
title: Test results
- name: Minimize uv cache
run: uv cache prune --ci
python-test-coverage:
name: Python Test Coverage
runs-on: [ubuntu-latest]
continue-on-error: true
permissions:
contents: write
defaults:
run:
working-directory: python
env:
UV_PYTHON: "3.10"
steps:
- uses: actions/checkout@v4
- name: Setup filename variables
run: echo "FILE_ID=${{ github.event.number }}" >> $GITHUB_ENV
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.30"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ env.UV_PYTHON }}
- name: Install the project
run: uv sync --all-extras --dev
- name: Test with pytest
run: uv run --frozen pytest -q --junitxml=pytest.xml --cov=semantic_kernel --cov-report=term-missing:skip-covered ./tests/unit | tee python-coverage.txt
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: python-coverage-${{ env.FILE_ID }}.txt
path: python/python-coverage.txt
overwrite: true
retention-days: 1
- name: Upload pytest.xml
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-${{ env.FILE_ID }}.xml
path: python/pytest.xml
overwrite: true
retention-days: 1
- name: Minimize uv cache
run: uv cache prune --ci