From 74a17ea912ae8c858a961ce59c30e87715f2ed6c Mon Sep 17 00:00:00 2001
From: James Briggs <35938317+jamescalam@users.noreply.github.com>
Date: Fri, 14 Feb 2025 18:53:45 +0400
Subject: [PATCH] fix: improve uv use

---
 .github/workflows/docs.yml    |  2 +-
 .github/workflows/lint.yml    | 19 ++++++++-----------
 .github/workflows/release.yml | 28 ++++++++++++----------------
 .github/workflows/test.yml    | 31 +++++++------------------------
 4 files changed, 28 insertions(+), 52 deletions(-)

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 769de616..8f38f040 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -23,7 +23,7 @@ jobs:
         enable-cache: true
         cache-dependency-glob: "uv.lock"
         python-version: ${{ matrix.python-version }}
-    - name: Sync uv for docs
+    - name: Install Dependencies
       run: uv sync --extra docs
     - name: Build docs
       run: |
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 98f875d1..3b2e2013 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -13,18 +13,15 @@ jobs:
         - "3.13"
     steps:
     - uses: actions/checkout@v3
-    - name: Cache uv
-      uses: actions/cache@v4
-      with:
-        path: ~/.uv
-        key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}-${{ matrix.python-version }}
-        restore-keys: |
-          ${{ runner.os }}-uv-${{ matrix.python-version }}
     - name: Install uv
+      uses: astral-sh/setup-uv@v5
+      with:
+        enable-cache: true
+        cache-dependency-glob: "uv.lock"
+        python-version: ${{ matrix.python-version }}
+    - name: Install Dependencies
       run: |
-        curl -LsSf https://astral.sh/uv/install.sh | sh
-        uv venv --python 3.13
-        uv pip install .[dev]
-    - name: Analyzing the code with our lint
+        uv sync --extra dev
+    - name: Run Lint
       run: |
         make lint
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index be3d2396..05c2453f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,20 +9,14 @@ jobs:
   build:
     runs-on: ubuntu-latest
     steps:
-    - name: Cache uv
-      uses: actions/cache@v4
-      with:
-        path: ~/.uv
-        key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}-${{ matrix.python-version }}
-        restore-keys: |
-          ${{ runner.os }}-uv-${{ matrix.python-version }}
-    - uses: actions/checkout@v2
-    - name: Set up Python
-      run: uv venv --python 3.13
     - name: Install uv
-      run: curl -LsSf https://astral.sh/uv/install.sh | sh
+      uses: astral-sh/setup-uv@v5
+      with:
+        enable-cache: true
+        cache-dependency-glob: "uv.lock"
+        python-version: ${{ matrix.python-version }}
     - name: Install dependencies
-      run: uv pip install .[dev]
+      run: uv sync --extra dev
     - name: Build
       run: uv build
 
@@ -31,12 +25,14 @@ jobs:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
-    - name: Set up Python
-      run: uv venv --python 3.13
     - name: Install uv
-      run: curl -LsSf https://astral.sh/uv/install.sh | sh
+      uses: astral-sh/setup-uv@v5
+      with:
+        enable-cache: true
+        cache-dependency-glob: "uv.lock"
+        python-version: ${{ matrix.python-version }}
     - name: Install dependencies
-      run: uv pip install .[dev]
+      run: uv sync --extra dev
     - name: Build
       run: uv build
     - name: Publish to PyPI
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b9e8ef18..17e6a6e7 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -25,31 +25,14 @@ jobs:
         - "3.13"
     steps:
     - uses: actions/checkout@v4
-    - name: Cache uv
-      uses: actions/cache@v4
-      with:
-        path: ~/.uv
-        key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}-${{ matrix.python-version }}
-        restore-keys: |
-          ${{ runner.os }}-uv-${{ matrix.python-version }}
-
-    - name: Wait for Pinecone service to start
-      run: |
-        echo "Waiting for Pinecone service to start..."
-        sleep 10  # Wait for 10 seconds to ensure the container is up
-
     - name: Install uv
-      run: |
-        curl -LsSf https://astral.sh/uv/install.sh | sh
-    - name: Set up Python ${{ matrix.python-version }}
-      run: uv venv --python ${{ matrix.python-version }}
-
-    # only needed for local testing
-    # - name: Add Poetry to PATH
-    #   run: echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
-
-    - name: Install dependencies
-      run: uv pip install .[all]
+      uses: astral-sh/setup-uv@v5
+      with:
+        enable-cache: true
+        cache-dependency-glob: "uv.lock"
+        python-version: ${{ matrix.python-version }}
+    - name: Install Dependencies
+      run: uv sync --extra all
     - name: Install nltk
       run: uv pip install nltk
 
-- 
GitLab