Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

perf: speed up CI with Docker layer caching and parallel tests (#1247)

LearningCircuita5bde59b2831
diff --git a/.github/workflows/enhanced-tests.yml b/.github/workflows/enhanced-tests.yml
index 8ce52915af..80bee5247c 100644
--- a/.github/workflows/enhanced-tests.yml
+++ b/.github/workflows/enhanced-tests.yml
@@ -26,8 +26,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run enhanced test framework tests
run: |
@@ -37,7 +47,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest -v \
+ sh -c "python -m pytest -v -n auto \
tests/test_wikipedia_url_security.py \
tests/test_search_engines_enhanced.py \
tests/test_utils.py \
diff --git a/.github/workflows/library-tests.yml b/.github/workflows/library-tests.yml
index 83832be07c..fb9dd6e2f1 100644
--- a/.github/workflows/library-tests.yml
+++ b/.github/workflows/library-tests.yml
@@ -42,8 +42,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run security unit tests
run: |
@@ -54,7 +64,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/security/ -v --tb=short"
+ sh -c "python -m pytest tests/security/ -v --tb=short -n auto"
# LLM provider tests
llm-provider-tests:
@@ -65,8 +75,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run LLM provider tests
run: |
@@ -77,7 +97,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/llm_providers/ -v --tb=short"
+ sh -c "python -m pytest tests/llm_providers/ -v --tb=short -n auto"
# Embeddings provider tests
embeddings-tests:
@@ -88,8 +108,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run embeddings provider tests
run: |
@@ -100,7 +130,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/embeddings/ -v --tb=short"
+ sh -c "python -m pytest tests/embeddings/ -v --tb=short -n auto"
# Search engine tests
search-engine-tests:
@@ -111,8 +141,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run search engine tests
run: |
@@ -123,7 +163,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/search_engines/ -v --tb=short"
+ sh -c "python -m pytest tests/search_engines/ -v --tb=short -n auto"
# Research library downloader tests
library-downloader-tests:
@@ -134,8 +174,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run research library downloader tests
run: |
@@ -146,7 +196,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/research_library/downloaders/ -v --tb=short"
+ sh -c "python -m pytest tests/research_library/downloaders/ -v --tb=short -n auto"
# Research library service tests
library-service-tests:
@@ -158,8 +208,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run library service tests
run: |
@@ -170,7 +230,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/research_library/services/ -v --tb=short"
+ sh -c "python -m pytest tests/research_library/services/ -v --tb=short -n auto"
# Collections API tests
collections-api-tests:
@@ -183,8 +243,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run collections API tests
run: |
@@ -195,7 +265,7 @@ jobs:
-e CI=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/api_tests/test_collections_api.py -v --tb=short"
+ sh -c "python -m pytest tests/api_tests/test_collections_api.py -v --tb=short -n auto"
# Library UI tests - Run natively on ubuntu-latest for proper browser support
library-ui-tests:
diff --git a/.github/workflows/llm-tests.yml b/.github/workflows/llm-tests.yml
index 9cebb99ad3..3420f58594 100644
--- a/.github/workflows/llm-tests.yml
+++ b/.github/workflows/llm-tests.yml
@@ -30,8 +30,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run LLM registry tests
run: |
@@ -40,7 +50,7 @@ jobs:
-e PYTHONPATH=/app \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_registry.py -v"
+ sh -c "python -m pytest tests/test_llm/test_llm_registry.py -v -n auto"
- name: Run LLM integration tests
run: |
@@ -50,7 +60,7 @@ jobs:
-e LDR_USE_FALLBACK_LLM=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_integration.py -v"
+ sh -c "python -m pytest tests/test_llm/test_llm_integration.py -v -n auto"
- name: Run API LLM integration tests
run: |
@@ -60,7 +70,7 @@ jobs:
-e LDR_USE_FALLBACK_LLM=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/test_llm/test_api_llm_integration.py -v"
+ sh -c "python -m pytest tests/test_llm/test_api_llm_integration.py -v -n auto"
- name: Run LLM edge case tests
run: |
@@ -69,7 +79,7 @@ jobs:
-e PYTHONPATH=/app \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_edge_cases.py -v"
+ sh -c "python -m pytest tests/test_llm/test_llm_edge_cases.py -v -n auto"
- name: Run LLM benchmark tests
run: |
@@ -78,7 +88,7 @@ jobs:
-e PYTHONPATH=/app \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_benchmarks.py -v"
+ sh -c "python -m pytest tests/test_llm/test_llm_benchmarks.py -v -n auto"
llm-example-tests:
runs-on: ubuntu-latest
@@ -88,8 +98,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Test basic custom LLM example
run: |
diff --git a/.github/workflows/security-tests.yml b/.github/workflows/security-tests.yml
index 7ef414da3d..5df2066ae0 100644
--- a/.github/workflows/security-tests.yml
+++ b/.github/workflows/security-tests.yml
@@ -84,56 +84,56 @@ jobs:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_security_db
run: |
# Run SQL injection specific tests
- pdm run python -m pytest tests/security/test_sql_injection.py -v --tb=short
+ pdm run python -m pytest tests/security/test_sql_injection.py -v --tb=short -n auto
# Legacy tests (if they exist)
if [ -f tests/test_sql_injection_prevention.py ]; then
- pdm run python -m pytest tests/test_sql_injection_prevention.py -v --tb=short
+ pdm run python -m pytest tests/test_sql_injection_prevention.py -v --tb=short -n auto
fi
- name: Run XSS prevention tests
run: |
- pdm run python -m pytest tests/security/test_xss_prevention.py -v --tb=short
+ pdm run python -m pytest tests/security/test_xss_prevention.py -v --tb=short -n auto
# Legacy tests (if they exist)
if [ -f tests/test_xss_prevention.py ]; then
- pdm run python -m pytest tests/test_xss_prevention.py -v --tb=short
+ pdm run python -m pytest tests/test_xss_prevention.py -v --tb=short -n auto
fi
- name: Run CSRF protection tests
run: |
- pdm run python -m pytest tests/security/test_csrf_protection.py -v --tb=short
+ pdm run python -m pytest tests/security/test_csrf_protection.py -v --tb=short -n auto
# Legacy tests (if they exist)
if [ -f tests/test_csrf_protection.py ]; then
- pdm run python -m pytest tests/test_csrf_protection.py -v --tb=short
+ pdm run python -m pytest tests/test_csrf_protection.py -v --tb=short -n auto
fi
- name: Run authentication security tests
run: |
- pdm run python -m pytest tests/security/test_auth_security.py -v --tb=short
+ pdm run python -m pytest tests/security/test_auth_security.py -v --tb=short -n auto
# Legacy tests (if they exist)
if [ -f tests/test_password_security.py ]; then
- pdm run python -m pytest tests/test_password_security.py -v --tb=short
+ pdm run python -m pytest tests/test_password_security.py -v --tb=short -n auto
fi
if [ -f tests/test_session_security.py ]; then
- pdm run python -m pytest tests/test_session_security.py -v --tb=short
+ pdm run python -m pytest tests/test_session_security.py -v --tb=short -n auto
fi
- name: Run API security tests
run: |
- pdm run python -m pytest tests/security/test_api_security.py -v --tb=short
+ pdm run python -m pytest tests/security/test_api_security.py -v --tb=short -n auto
# Legacy tests (if they exist)
if [ -f tests/test_rate_limiting.py ]; then
- pdm run python -m pytest tests/test_rate_limiting.py -v --tb=short
+ pdm run python -m pytest tests/test_rate_limiting.py -v --tb=short -n auto
fi
if [ -f tests/test_api_authentication.py ]; then
- pdm run python -m pytest tests/test_api_authentication.py -v --tb=short
+ pdm run python -m pytest tests/test_api_authentication.py -v --tb=short -n auto
fi
- name: Run input validation tests
run: |
- pdm run python -m pytest tests/security/test_input_validation.py -v --tb=short
+ pdm run python -m pytest tests/security/test_input_validation.py -v --tb=short -n auto
# Legacy tests (if they exist)
if [ -f tests/test_input_sanitization.py ]; then
- pdm run python -m pytest tests/test_input_sanitization.py -v --tb=short
+ pdm run python -m pytest tests/test_input_sanitization.py -v --tb=short -n auto
fi
- name: Check for hardcoded secrets
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 182183bf22..f8d94b9f0f 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -20,8 +20,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
@@ -65,8 +75,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
@@ -83,7 +103,7 @@ jobs:
-v "$PWD":/app \
-w /app \
ldr-test \
- sh -c "pytest tests/infrastructure_tests/test_*.py -v"
+ sh -c "pytest tests/infrastructure_tests/test_*.py -v -n auto"
- name: Run JavaScript infrastructure tests
run: |
@@ -99,8 +119,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run CI test profile
run: |
@@ -125,8 +155,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run text optimization tests
run: |
@@ -136,7 +176,7 @@ jobs:
-e LDR_TESTING_WITH_MOCKS=true \
-w /app \
ldr-test \
- sh -c "python -m pytest tests/text_optimization/ -v"
+ sh -c "python -m pytest tests/text_optimization/ -v -n auto"
# Extended pytest tests (beyond unit tests)
extended-pytest-tests:
@@ -151,8 +191,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Run extended pytest suite
run: |
@@ -170,6 +220,7 @@ jobs:
--cov-report=term \
--tb=short \
--durations=10 \
+ -n auto \
tests/searxng/"
# UI tests
@@ -185,8 +236,18 @@ jobs:
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker image with cache
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ target: ldr-test
+ load: true
+ tags: ldr-test
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
- name: Install Node.js for UI tests
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
diff --git a/pyproject.toml b/pyproject.toml
index 172436fd8e..d9094afad3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -139,6 +139,7 @@ dev = [
"pytest-cov~=7.0",
"pytest-timeout~=2.4",
"pytest-asyncio~=1.3",
+ "pytest-xdist>=3.5",
"ruff~=0.14",
"freezegun~=1.5",
"mypy~=1.19",