From f3720c161ccfd481abdb113f5276b176a08c8d88 Mon Sep 17 00:00:00 2001
From: Remco de Boer <29308176+redeboer@users.noreply.github.com>
Date: Fri, 18 Oct 2024 11:19:27 +0200
Subject: [PATCH] FIX: run additiona `pytest` worfklows with setup-uv

---
 .cspell.json                         |  1 +
 .github/workflows/benchmark.yml      | 31 ++++++++++++++++++++--------
 .github/workflows/ci-qrules-v0.9.yml | 18 +++++++++-------
 3 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/.cspell.json b/.cspell.json
index d5505979..51795b79 100644
--- a/.cspell.json
+++ b/.cspell.json
@@ -150,6 +150,7 @@
     "nowrap",
     "nrows",
     "nsimplify",
+    "numprocesses",
     "numpycode",
     "pandoc",
     "pbar",
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index 92ed10c3..6b69d6ee 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -23,18 +23,31 @@ jobs:
     runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v4
-      - uses: ComPWA/actions/pip-install@v1
+      - uses: actions/setup-python@v5
         with:
-          editable: "yes"
-          extras: test,all
-          python-version: "3.9"
-          specific-packages: ${{ inputs.specific-pip-packages }}
+          python-version: "3.12"
+      - uses: astral-sh/setup-uv@v3
+        with:
+          enable-cache: true
+      - id: with
+        if: inputs.specific-pip-packages
+        name: Determine additional packages to install
+        run: |
+          additional_packages=''
+          for package in ${{ inputs.specific-pip-packages }}; do
+            additional_packages="$additional_packages --with $package"
+          done
+          echo "packages=$additional_packages" | tee -a $GITHUB_OUTPUT
       - name: Run pytest-benchmark
         run: |
-          pytest \
-            -k benchmark \
-            --benchmark-json output.json \
-            --durations=0
+          uv run \
+            --extra all \
+            --extra test \
+            ${{ steps.with.outputs.packages }} \
+            pytest \
+              -k benchmark \
+              --benchmark-json output.json \
+              --durations=0
         working-directory: benchmarks
       - name: Store result
         if: github.event_name == 'push'
diff --git a/.github/workflows/ci-qrules-v0.9.yml b/.github/workflows/ci-qrules-v0.9.yml
index ac92a94a..31d4bc39 100644
--- a/.github/workflows/ci-qrules-v0.9.yml
+++ b/.github/workflows/ci-qrules-v0.9.yml
@@ -26,11 +26,15 @@ jobs:
     runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v4
-      - uses: ComPWA/actions/pip-install@v1
+      - uses: actions/setup-python@v5
         with:
-          additional-packages: tox
-          editable: "yes"
-          extras: test
-          python-version: "3.9"
-          specific-packages: qrules==0.9.*
-      - run: pytest -n auto
+          python-version: "3.12"
+      - uses: astral-sh/setup-uv@v3
+        with:
+          enable-cache: true
+      - name: Run pytest with QRules v0.9
+        run: |
+          uv run \
+            --extra test \
+            --with qrules~=0.9.0 \
+            pytest --numprocesses auto