]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
👷 Make Pydantic versions customizable in CI (#14535)
authorSebastián Ramírez <tiangolo@gmail.com>
Tue, 16 Dec 2025 17:00:12 +0000 (09:00 -0800)
committerGitHub <noreply@github.com>
Tue, 16 Dec 2025 17:00:12 +0000 (18:00 +0100)
.github/workflows/test.yml

index 85f9c4afd05f0aa2f462ccf9937b860f1ad2e795..f68622f27bfb5deb12f4305699674e67b950e177 100644 (file)
@@ -31,15 +31,11 @@ jobs:
       - name: Setup uv
         uses: astral-sh/setup-uv@v7
         with:
-          version: "0.4.15"
-          enable-cache: true
           cache-dependency-glob: |
             requirements**.txt
             pyproject.toml
       - name: Install Dependencies
         run: uv pip install -r requirements-tests.txt
-      - name: Install Pydantic v2
-        run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0"
       - name: Lint
         run: bash scripts/lint.sh
 
@@ -48,38 +44,42 @@ jobs:
       matrix:
         os: [ windows-latest, macos-latest ]
         python-version: [ "3.14" ]
-        pydantic-version: [ "pydantic-v2" ]
+        pydantic-version: [ "pydantic>=2.0.2,<3.0.0" ]
         include:
           - os: macos-latest
             python-version: "3.8"
-            pydantic-version: "pydantic-v1"
+            pydantic-version: "pydantic>=1.10.0,<2.0.0"
           - os: windows-latest
             python-version: "3.8"
-            pydantic-version: "pydantic-v2"
+            pydantic-version: "pydantic>=2.0.2,<3.0.0"
             coverage: coverage
           - os: ubuntu-latest
             python-version: "3.9"
-            pydantic-version: "pydantic-v1"
+            pydantic-version: "pydantic>=1.10.0,<2.0.0"
             coverage: coverage
           - os: macos-latest
             python-version: "3.10"
-            pydantic-version: "pydantic-v2"
+            pydantic-version: "pydantic>=2.0.2,<3.0.0"
           - os: windows-latest
             python-version: "3.11"
-            pydantic-version: "pydantic-v1"
+            pydantic-version: "pydantic>=1.10.0,<2.0.0"
           - os: ubuntu-latest
             python-version: "3.12"
-            pydantic-version: "pydantic-v2"
+            pydantic-version: "pydantic>=2.0.2,<3.0.0"
           - os: macos-latest
             python-version: "3.13"
-            pydantic-version: "pydantic-v1"
+            pydantic-version: "pydantic>=1.10.0,<2.0.0"
           - os: windows-latest
             python-version: "3.13"
-            pydantic-version: "pydantic-v2"
+            pydantic-version: "pydantic>=2.0.2,<3.0.0"
             coverage: coverage
+          # - os: ubuntu-latest
+          #   python-version: "3.13"
+          #   pydantic-version: "pydantic>=2.0.2,<2.7.0"
+          #   coverage: coverage
           - os: ubuntu-latest
             python-version: "3.14"
-            pydantic-version: "pydantic-v2"
+            pydantic-version: "pydantic>=2.0.2,<3.0.0"
             coverage: coverage
       fail-fast: false
     runs-on: ${{ matrix.os }}
@@ -103,12 +103,8 @@ jobs:
             pyproject.toml
       - name: Install Dependencies
         run: uv pip install -r requirements-tests.txt
-      - 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"
+      - name: Install Pydantic
+        run: uv pip install "${{ matrix.pydantic-version }}"
       # TODO: Remove this once Python 3.8 is no longer supported
       - name: Install older AnyIO in Python 3.8
         if: matrix.python-version == '3.8'
@@ -124,7 +120,7 @@ jobs:
         if: matrix.coverage == 'coverage'
         uses: actions/upload-artifact@v5
         with:
-          name: coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pydantic-version }}
+          name: coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/coverage/.coverage.*') }}
           path: coverage
           include-hidden-files: true