Skip to content

Commit 1948dd4

Browse files
authored
ci: llama.cpp - simplify test setup (#3113)
* test: fix llama.cpp * restore wf * only exclude version for macos * better uv config * try * retry * rm specific macos handling * try testing with 3.10 and 3.14
1 parent aae301c commit 1948dd4

2 files changed

Lines changed: 11 additions & 28 deletions

File tree

.github/workflows/llama_cpp.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ on:
1717
- "integrations/llama_cpp/**"
1818
- "!integrations/llama_cpp/*.md"
1919
- ".github/workflows/llama_cpp.yml"
20-
2120
defaults:
2221
run:
2322
working-directory: integrations/llama_cpp
@@ -29,6 +28,8 @@ concurrency:
2928
env:
3029
PYTHONUNBUFFERED: "1"
3130
FORCE_COLOR: "1"
31+
TEST_MATRIX_OS: '["ubuntu-latest", "windows-latest", "macos-latest"]'
32+
TEST_MATRIX_PYTHON: '["3.10", "3.14"]'
3233

3334
jobs:
3435
compute-test-matrix:
@@ -37,26 +38,13 @@ jobs:
3738
run:
3839
working-directory: .
3940
outputs:
40-
matrix: ${{ steps.set.outputs.matrix }}
41+
os: ${{ steps.set.outputs.os }}
42+
python-version: ${{ steps.set.outputs.python-version }}
4143
steps:
4244
- id: set
4345
run: |
44-
if [ "${{ github.event_name }}" = "push" ]; then
45-
echo 'matrix=[{"os":"ubuntu-latest","python-version":"3.10"}]' >> "$GITHUB_OUTPUT"
46-
else
47-
MATRIX='['
48-
MATRIX+='{"os":"ubuntu-latest","python-version":"3.10"},'
49-
MATRIX+='{"os":"ubuntu-latest","python-version":"3.14"},'
50-
MATRIX+='{"os":"windows-latest","python-version":"3.10"},'
51-
MATRIX+='{"os":"windows-latest","python-version":"3.14"},'
52-
# On macOS, pre-built wheels for 3.14 are not available and installing from source
53-
# might fail due to missing dependencies (CMake fails with "OpenMP not found").
54-
# We test with 3.12 instead because pre-built wheels are available for this version.
55-
MATRIX+='{"os":"macos-latest","python-version":"3.10"},'
56-
MATRIX+='{"os":"macos-latest","python-version":"3.12"}'
57-
MATRIX+=']'
58-
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
59-
fi
46+
echo 'os=${{ github.event_name == 'push' && '["ubuntu-latest"]' || env.TEST_MATRIX_OS }}' >> "$GITHUB_OUTPUT"
47+
echo 'python-version=${{ github.event_name == 'push' && '["3.10"]' || env.TEST_MATRIX_PYTHON }}' >> "$GITHUB_OUTPUT"
6048
6149
run:
6250
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
@@ -68,7 +56,8 @@ jobs:
6856
strategy:
6957
fail-fast: false
7058
matrix:
71-
include: ${{ fromJSON(needs.compute-test-matrix.outputs.matrix) }}
59+
os: ${{ fromJSON(needs.compute-test-matrix.outputs.os) }}
60+
python-version: ${{ fromJSON(needs.compute-test-matrix.outputs.python-version) }}
7261

7362
steps:
7463
- name: Support longpaths

integrations/llama_cpp/pyproject.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ classifiers = [
2626
"Programming Language :: Python :: Implementation :: CPython",
2727
"Programming Language :: Python :: Implementation :: PyPy",
2828
]
29-
dependencies = ["haystack-ai>=2.22.0", "llama-cpp-python>=0.2.87"]
30-
31-
# On macOS GitHub runners, we use a custom index to download pre-built wheels.
32-
# Installing from source might fail due to missing dependencies (CMake fails with "OpenMP not found")
33-
[tool.uv]
34-
index-strategy = "unsafe-best-match" # this ensures that packages are not only searched in the below index but also in PyPI
35-
[[tool.uv.index]]
36-
name = "llama-cpp-python-macos"
37-
url = "https://abetlen.github.io/llama-cpp-python/whl/metal/"
29+
dependencies = [
30+
"haystack-ai>=2.22.0", "llama-cpp-python>=0.2.87"
31+
]
3832

3933
[project.urls]
4034
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/llama_cpp#readme"

0 commit comments

Comments
 (0)