Просмотр исходного кода

ci: speed up workflows by using uv instead of pip

Jason Rumney 3 дней назад
Родитель
Сommit
21a8577e8e

+ 7 - 4
.github/workflows/jsontests.yml

@@ -11,6 +11,9 @@ on:
       - 'custom_components/tuya_local/translations/*.json'
       - 'custom_components/tuya_local/icons.json'
 
+env:
+  UV_SYSTEM_PYTHON 1
+
 jobs:
   tests:
     runs-on: ubuntu-latest
@@ -29,12 +32,12 @@ jobs:
         with:
           fetch-depth: 0
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v5
+        uses: actions/setup-python@v6
         with:
           python-version: ${{ matrix.python-version }}
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
       - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          pip install -r requirements-dev.txt
+        run: uv pip install -r requirements-dev.txt
       - name: Translations check with pytest
         run: pytest tests/test_translations.py

+ 7 - 4
.github/workflows/linting.yml

@@ -2,6 +2,9 @@ name: Linting
 
 on: [push, pull_request]
 
+env:
+  UV_SYSTEM_PYTHON 1
+
 jobs:
   lint:
     runs-on: ubuntu-latest
@@ -13,14 +16,14 @@ jobs:
       - uses: actions/checkout@v4
 
       - name: Setup Python
-        uses: actions/setup-python@v5
+        uses: actions/setup-python@v6
         with:
           python-version: '3.13'
 
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
       - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          pip install -r requirements-dev.txt
+        run: uv pip install -r requirements-dev.txt
       - name: Python lint
         run: ruff check --output-format=github .
       - name: Python include order

+ 7 - 3
.github/workflows/tests.yml

@@ -11,6 +11,9 @@ on:
       - '**.py'
       - 'requirements-dev.txt'
 
+env:
+  UV_SYSTEM_PYTHON 1
+
 jobs:
   tests:
     runs-on: ubuntu-latest
@@ -27,15 +30,16 @@ jobs:
         with:
           fetch-depth: 0
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v5
+        uses: actions/setup-python@v6
         with:
           python-version: ${{ matrix.python-version }}
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
       - name: Install dependencies
         run: |
           sudo apt-get update
           sudo apt-get install libturbojpeg
-          python -m pip install --upgrade pip
-          pip install -r requirements-dev.txt
+          uv pip install -r requirements-dev.txt
       - name: Full test with pytest
         run: pytest --cov=custom_components/tuya_local --cov-report term:skip-covered --junit-xml=test-results.xml
       - name: Surface results

+ 5 - 4
.github/workflows/yamltests.yml

@@ -24,19 +24,20 @@ jobs:
 
     env:
       PYTHONPATH: .
+      UV_SYSTEM_PYTHON 1
 
     steps:
       - uses: actions/checkout@v4
         with:
           fetch-depth: 0
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v5
+        uses: actions/setup-python@v6
         with:
           python-version: ${{ matrix.python-version }}
+      - name: Install uv
+        uses: astral-sh/setup-uv@v7
       - name: Install dependencies
-        run: |
-          python -m pip install --upgrade pip
-          pip install -r requirements-dev.txt
+        run:  uv pip install -r requirements-dev.txt
       - name: Device configs check with pytest
         run: |
           pytest tests/test_device_config.py