]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
👷 Use uv in CI (#1135)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 12 Oct 2024 13:08:11 +0000 (15:08 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Oct 2024 13:08:11 +0000 (15:08 +0200)
.github/workflows/build-docs.yml
.github/workflows/deploy-docs.yml
.github/workflows/smokeshow.yml
.github/workflows/test.yml
requirements-github-actions.txt

index 00adbfbc5ead6f9958d4dfcc821b1b6a0a46bd12..c35a212039f206792c752bf311fa56e6357bf094 100644 (file)
@@ -7,6 +7,11 @@ on:
     types:
       - opened
       - synchronize
+
+env:
+  UV_SYSTEM_PYTHON: 1
+
+
 jobs:
   changes:
     runs-on: ubuntu-latest
@@ -52,17 +57,19 @@ jobs:
         uses: actions/setup-python@v5
         with:
           python-version: "3.11"
-      - uses: actions/cache@v4
-        id: cache
+      - name: Setup uv
+        uses: astral-sh/setup-uv@v3
         with:
-          path: ${{ env.pythonLocation }}
-          key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-insiders.txt', 'requirements-docs-tests.txt') }}-v02
+          version: "0.4.15"
+          enable-cache: true
+          cache-dependency-glob: |
+            requirements**.txt
+            pyproject.toml
       - name: Install docs extras
-        if: steps.cache.outputs.cache-hit != 'true'
-        run: pip install -r requirements-docs.txt
+        run: uv pip install -r requirements-docs.txt
       - name: Install Material for MkDocs Insiders
-        if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
-        run: pip install -r requirements-docs-insiders.txt
+        if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
+        run: uv pip install -r requirements-docs-insiders.txt
         env:
           TOKEN: ${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}
       - uses: actions/cache@v4
index 6e099c2069d3b2c0bd093f3fc77dc8221d9e7a90..6849bd782f04c85bc7740f6367413d795aab99d9 100644 (file)
@@ -12,6 +12,9 @@ permissions:
   pull-requests: write
   statuses: write
 
+env:
+  UV_SYSTEM_PYTHON: 1
+
 jobs:
   deploy-docs:
     runs-on: ubuntu-latest
@@ -25,14 +28,16 @@ jobs:
         uses: actions/setup-python@v5
         with:
           python-version: "3.11"
-      - uses: actions/cache@v4
-        id: cache
+      - name: Setup uv
+        uses: astral-sh/setup-uv@v3
         with:
-          path: ${{ env.pythonLocation }}
-          key: ${{ runner.os }}-python-github-actions-${{ env.pythonLocation }}-${{ hashFiles('requirements-github-actions.txt') }}-v01
+          version: "0.4.15"
+          enable-cache: true
+          cache-dependency-glob: |
+            requirements**.txt
+            pyproject.toml
       - name: Install GitHub Actions dependencies
-        if: steps.cache.outputs.cache-hit != 'true'
-        run: pip install -r requirements-github-actions.txt
+        run: uv pip install -r requirements-github-actions.txt
       - name: Deploy Docs Status Pending
         run: python ./scripts/deploy_docs_status.py
         env:
index bc37a92e785b8a51a6392121cec4c04eb59d79d8..2280a9de620010f7a3e5ca7f1f8816a8c187a703 100644 (file)
@@ -8,6 +8,9 @@ on:
 permissions:
   statuses: write
 
+env:
+  UV_SYSTEM_PYTHON: 1
+
 jobs:
   smokeshow:
     if: ${{ github.event.workflow_run.conclusion == 'success' }}
@@ -17,16 +20,21 @@ jobs:
       - uses: actions/setup-python@v5
         with:
           python-version: '3.9'
-
-      - run: pip install smokeshow
-
+      - name: Setup uv
+        uses: astral-sh/setup-uv@v3
+        with:
+          version: "0.4.15"
+          enable-cache: true
+          cache-dependency-glob: |
+            requirements**.txt
+            pyproject.toml
+      - run: uv pip install -r requirements-github-actions.txt
       - uses: actions/download-artifact@v4
         with:
           name: coverage-html
           path: htmlcov
           github-token: ${{ secrets.GITHUB_TOKEN }}
           run-id: ${{ github.event.workflow_run.id }}
-
       - run: smokeshow upload htmlcov
         env:
           SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
index 614235e4753cd12d37e26f72e9fd4c2d143ff68c..3509d5d3dfb6300261fc1a4caf0ae5c749b04181 100644 (file)
@@ -18,6 +18,9 @@ on:
     # cron every week on monday
     - cron: "0 0 * * 1"
 
+env:
+  UV_SYSTEM_PYTHON: 1
+
 jobs:
   test:
     runs-on: ubuntu-latest
@@ -34,33 +37,34 @@ jobs:
           - pydantic-v1
           - pydantic-v2
       fail-fast: false
-
     steps:
       - uses: actions/checkout@v4
       - name: Set up Python
         uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python-version }}
+      - name: Setup uv
+        uses: astral-sh/setup-uv@v3
+        with:
+          version: "0.4.15"
+          enable-cache: true
+          cache-dependency-glob: |
+            requirements**.txt
+            pyproject.toml
       # Allow debugging with tmate
       - name: Setup tmate session
         uses: mxschmitt/action-tmate@v3
         if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
         with:
           limit-access-to-actor: true
-      - uses: actions/cache@v4
-        id: cache
-        with:
-          path: ${{ env.pythonLocation }}
-          key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}-v01
       - name: Install Dependencies
-        if: steps.cache.outputs.cache-hit != 'true'
-        run: pip install -r requirements-tests.txt
+        run: uv pip install -r requirements-tests.txt
       - name: Install Pydantic v1
         if: matrix.pydantic-version == 'pydantic-v1'
-        run: pip install --upgrade "pydantic>=1.10.0,<2.0.0"
+        run: uv pip install --upgrade "pydantic>=1.10.0,<2.0.0"
       - name: Install Pydantic v2
         if: matrix.pydantic-version == 'pydantic-v2'
-        run: pip install --upgrade "pydantic>=2.0.2,<3.0.0" "typing-extensions==4.6.1"
+        run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0" "typing-extensions==4.6.1"
       - name: Lint
         # Do not run on Python 3.7 as mypy behaves differently
         if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2'
@@ -82,28 +86,31 @@ jobs:
     needs:
       - test
     runs-on: ubuntu-latest
-
     steps:
       - uses: actions/checkout@v4
-
       - uses: actions/setup-python@v5
         with:
           python-version: '3.12'
-
+      - name: Setup uv
+        uses: astral-sh/setup-uv@v3
+        with:
+          version: "0.4.15"
+          enable-cache: true
+          cache-dependency-glob: |
+            requirements**.txt
+            pyproject.toml
       - name: Get coverage files
         uses: actions/download-artifact@v4
         with:
           pattern: coverage-*
           path: coverage
           merge-multiple: true
-
-      - run: pip install coverage[toml]
-
+      - name: Install Dependencies
+        run: uv pip install -r requirements-tests.txt
       - 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:
index 559dc06fb2dd7280bdde52fd0962c86786f8bedf..a6dace544fb53dff511698890f6ba0bf5882a70e 100644 (file)
@@ -2,3 +2,4 @@ PyGithub>=2.3.0,<3.0.0
 pydantic>=2.5.3,<3.0.0
 pydantic-settings>=2.1.0,<3.0.0
 httpx>=0.27.0,<0.28.0
+smokeshow