~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
ci: consolidate 15 test jobs into 3 workflow files
LearningCircuit8cc0166412de
diff --git a/.github/workflows/library-tests.yml b/.github/workflows/library-tests.ymldeleted file mode 100644index 119194dcbf..0000000000--- a/.github/workflows/library-tests.yml+++ /dev/null@@ -1,438 +0,0 @@-name: Library & Collections Tests--on:- push:- branches: [ main, dev ]- pull_request:- branches: [ main, dev ]- workflow_dispatch:--permissions:- contents: read--jobs:- # Security module tests- security-unit-tests:- runs-on: ubuntu-latest- name: Security Unit Tests- timeout-minutes: 10-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -w /app \- ldr-test \- sh -c "python -m pytest tests/security/ -v --tb=short -n auto"-- # LLM provider tests- llm-provider-tests:- runs-on: ubuntu-latest- name: LLM Provider Tests- timeout-minutes: 10-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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- env:- OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}- run: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -e OPENROUTER_API_KEY="${OPENROUTER_API_KEY}" \- -w /app \- ldr-test \- sh -c "python -m pytest tests/llm_providers/ -v --tb=short -n auto"-- # Embeddings provider tests- embeddings-tests:- runs-on: ubuntu-latest- name: Embeddings Provider Tests- timeout-minutes: 10-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -w /app \- ldr-test \- sh -c "python -m pytest tests/embeddings/ -v --tb=short -n auto"-- # Search engine tests- search-engine-tests:- runs-on: ubuntu-latest- name: Search Engine Tests- timeout-minutes: 10-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -w /app \- ldr-test \- sh -c "python -m pytest tests/search_engines/ -v --tb=short -n auto"-- # Research library downloader tests- library-downloader-tests:- runs-on: ubuntu-latest- name: Library Downloader Tests- timeout-minutes: 10-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -w /app \- ldr-test \- sh -c "python -m pytest tests/research_library/downloaders/ -v --tb=short -n auto"-- # Research library service tests- library-service-tests:- runs-on: ubuntu-latest- name: Library Service Tests- timeout-minutes: 15- # Removed needs: [library-downloader-tests] - tests are independent-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -w /app \- ldr-test \- sh -c "python -m pytest tests/research_library/services/ -v --tb=short -n auto"-- # Collections API tests- collections-api-tests:- runs-on: ubuntu-latest- name: Collections API Tests- timeout-minutes: 15-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -w /app \- ldr-test \- 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:- runs-on: ubuntu-latest- name: Library UI Tests- timeout-minutes: 20-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Python- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6- with:- python-version: '3.12'-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.12'- cache: true-- - name: Install system dependencies for SQLCipher- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev-- - name: Install Python dependencies- run: pdm sync -d-- - name: Install UI test dependencies- run: cd tests && npm ci-- - name: Install browser dependencies- run: npx puppeteer browsers install chrome-- - name: Setup test directories- run: |- mkdir -p data/encrypted_databases- mkdir -p tests/ui_tests/screenshots- echo "Created data and screenshots directories for tests"-- # Pre-create test_admin user to speed up tests (avoids slow registration).- # IMPORTANT: LDR_DATA_DIR and LDR_DB_KDF_ITERATIONS must match between this step and "Start application server"!- # See scripts/ci/init_test_database.py for details.- - name: Initialize database with test user- env:- TEST_ENV: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000"- run: |- cd src- pdm run python ../scripts/ci/init_test_database.py-- - name: Start application server- env:- CI: true- LDR_USE_FALLBACK_LLM: true- DISABLE_RATE_LIMITING: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000"- run: |- export PYTHONPATH=$PWD/src:$PYTHONPATH- echo "Starting web server with LDR_DATA_DIR=$LDR_DATA_DIR"- pdm run python -m local_deep_research.web.app 2>&1 | tee server.log &- echo $! > server.pid-- - name: Wait for server to be ready- run: |- # Wait up to 60 seconds for server to start- for i in {1..60}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- if ! kill -0 "$(cat server.pid)" 2>/dev/null; then- echo "Server process died!"- echo "Server log:"- cat server.log- exit 1- fi- echo "Waiting for server... ($i/60)"- sleep 1- done-- # Final check- if ! curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server failed to start after 60 seconds"- echo "Server log:"- cat server.log- exit 1- fi-- - name: Run library UI tests- run: |- export CI=true- export LDR_USE_FALLBACK_LLM=true- export DISPLAY=:99- cd tests/ui_tests && xvfb-run -a -s "-screen 0 1920x1080x24" node library/test_collections_page.js-- - name: Stop server- if: always()- run: |- if [ -f server.pid ]; then- kill "$(cat server.pid)" || true- rm server.pid- fi-- - name: Upload UI test screenshots- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: library-ui-test-screenshots- path: |- tests/screenshots/- tests/ui_tests/screenshots/-- - name: Upload server logs- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: library-ui-server-logs- path: server.logdiff --git a/.github/workflows/library-ui-tests.yml b/.github/workflows/library-ui-tests.ymlnew file mode 100644index 0000000000..52625a8009--- /dev/null+++ b/.github/workflows/library-ui-tests.yml@@ -0,0 +1,146 @@+name: Library UI Tests++on:+ push:+ branches: [ main, dev ]+ pull_request:+ branches: [ main, dev ]+ workflow_dispatch:++permissions:+ contents: read++jobs:+ library-ui-tests:+ runs-on: ubuntu-latest+ name: Library UI Tests+ timeout-minutes: 20++ steps:+ - name: Harden the runner (Audit all outbound calls)+ uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0+ with:+ egress-policy: audit++ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1++ with:+ persist-credentials: false++ - name: Set up Python+ uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6+ with:+ python-version: '3.12'++ - name: Set up Node.js+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0+ with:+ node-version: '20'++ - name: Set up PDM+ uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4+ with:+ python-version: '3.12'+ cache: true++ - name: Install system dependencies for SQLCipher+ run: |+ sudo apt-get update+ sudo apt-get install -y libsqlcipher-dev++ - name: Install Python dependencies+ run: pdm sync -d++ - name: Install UI test dependencies+ run: cd tests && npm ci++ - name: Install browser dependencies+ run: npx puppeteer browsers install chrome++ - name: Setup test directories+ run: |+ mkdir -p data/encrypted_databases+ mkdir -p tests/ui_tests/screenshots+ echo "Created data and screenshots directories for tests"++ # Pre-create test_admin user to speed up tests (avoids slow registration).+ # IMPORTANT: LDR_DATA_DIR and LDR_DB_KDF_ITERATIONS must match between this step and "Start application server"!+ # See scripts/ci/init_test_database.py for details.+ - name: Initialize database with test user+ env:+ TEST_ENV: true+ LDR_DATA_DIR: ${{ github.workspace }}/data+ LDR_DB_KDF_ITERATIONS: "1000"+ run: |+ cd src+ pdm run python ../scripts/ci/init_test_database.py++ - name: Start application server+ env:+ CI: true+ LDR_USE_FALLBACK_LLM: true+ DISABLE_RATE_LIMITING: true+ LDR_DATA_DIR: ${{ github.workspace }}/data+ LDR_DB_KDF_ITERATIONS: "1000"+ run: |+ export PYTHONPATH=$PWD/src:$PYTHONPATH+ echo "Starting web server with LDR_DATA_DIR=$LDR_DATA_DIR"+ pdm run python -m local_deep_research.web.app 2>&1 | tee server.log &+ echo $! > server.pid++ - name: Wait for server to be ready+ run: |+ # Wait up to 60 seconds for server to start+ for i in {1..60}; do+ if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then+ echo "Server is ready after $i seconds"+ break+ fi+ if ! kill -0 "$(cat server.pid)" 2>/dev/null; then+ echo "Server process died!"+ echo "Server log:"+ cat server.log+ exit 1+ fi+ echo "Waiting for server... ($i/60)"+ sleep 1+ done++ # Final check+ if ! curl -f http://localhost:5000/api/v1/health 2>/dev/null; then+ echo "Server failed to start after 60 seconds"+ echo "Server log:"+ cat server.log+ exit 1+ fi++ - name: Run library UI tests+ run: |+ export CI=true+ export LDR_USE_FALLBACK_LLM=true+ export DISPLAY=:99+ cd tests/ui_tests && xvfb-run -a -s "-screen 0 1920x1080x24" node library/test_collections_page.js++ - name: Stop server+ if: always()+ run: |+ if [ -f server.pid ]; then+ kill "$(cat server.pid)" || true+ rm server.pid+ fi++ - name: Upload UI test screenshots+ if: always()+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: library-ui-test-screenshots+ path: |+ tests/screenshots/+ tests/ui_tests/screenshots/++ - name: Upload server logs+ if: always()+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: library-ui-server-logs+ path: server.logdiff --git a/.github/workflows/tests.yml b/.github/workflows/pytest-tests.ymlsimilarity index 51%rename from .github/workflows/tests.ymlrename to .github/workflows/pytest-tests.ymlindex 10de242e90..ce66570c57 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/pytest-tests.yml@@ -1,4 +1,4 @@-name: Tests+name: Pytest Testson:push:@@ -8,277 +8,19 @@ on:branches: [ main, dev ]workflow_dispatch:+# Permissions needed for GitHub Pages deployment and PR commentspermissions:- contents: read+ contents: write+ pull-requests: write-jobs:- # Fast unit tests for every push- unit-tests:- runs-on: ubuntu-latest- name: Unit Tests (Fast)-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'-- - name: Install infrastructure test dependencies- run: |- cd tests/infrastructure_tests && npm ci-- - name: Run unit tests only- run: |- docker run --rm \- -v "$PWD":/app \- -e CI=true \- -e GITHUB_ACTIONS=true \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e DISABLE_RATE_LIMITING=true \- -w /app \- ldr-test \- sh -c "python -m pytest -v \- --ignore=tests/auth_tests/test_auth_rate_limiting.py \- tests/unit/ \- tests/test_settings_manager.py \- tests/test_google_pse.py \- tests/test_wikipedia_url_security.py \- tests/test_search_engines_enhanced.py \- tests/test_utils.py \- tests/test_database_initialization.py \- tests/rate_limiting/ \- tests/retriever_integration/ \- tests/feature_tests/ \- tests/fix_tests/ \- tests/auth_tests/ \- tests/security/ \- tests/deletion/ \- tests/database/test_sqlcipher_missing.py \- tests/database/test_encryption_threads.py \- tests/database/test_encryption_constants.py \- tests/database/test_schema_stability.py \- tests/database/test_backwards_compatibility.py \- tests/search_engines/"-- - name: Run JavaScript infrastructure tests- run: |- cd tests/infrastructure_tests && npm test-- # Infrastructure tests for every push- infrastructure-tests:- runs-on: ubuntu-latest- name: Infrastructure Tests-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'-- - name: Install JavaScript test dependencies- run: |- cd tests/infrastructure_tests && npm ci-- - name: Run Python infrastructure tests- run: |- docker run --rm \- -v "$PWD":/app \- -w /app \- ldr-test \- sh -c "pytest tests/infrastructure_tests/test_*.py -v -n auto"-- - name: Run JavaScript infrastructure tests- run: |- cd tests/infrastructure_tests && npm test-- # Standard tests for PRs and main branch- integration-tests:- runs-on: ubuntu-latest- name: Integration Tests- if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -w /app \- ldr-test \- sh -c "cd tests && python run_all_tests.py ci --no-server-start"-- # Text optimization and integration tests- text-optimization-tests:- runs-on: ubuntu-latest- name: Text Optimization Tests- if: |- github.event_name == 'pull_request' ||- github.ref == 'refs/heads/main' ||- github.ref == 'refs/heads/dev'-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1+env:+ TEST_IMAGE: ldr-test+ PAGES_URL: https://learningcircuit.github.io/local-deep-research/- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -w /app \- ldr-test \- sh -c "python -m pytest tests/text_optimization/ -v -n auto"-- # Extended pytest tests (beyond unit tests)- extended-pytest-tests:- runs-on: ubuntu-latest- name: Extended Pytest Suite- if: |- github.event_name == 'pull_request' ||- github.ref == 'refs/heads/main' ||- github.ref == 'refs/heads/dev'-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0- with:- egress-policy: audit-- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-- with:- persist-credentials: false-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 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: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -e PYTHONPATH=/app/src \- -w /app \- ldr-test \- sh -c "python -m pytest \- --verbose \- --color=yes \- --cov=src \- --cov-report=term \- --tb=short \- --durations=10 \- -n auto \- tests/searxng/ \- tests/search_engines/"-- # UI tests- ui-tests-full:+jobs:+ pytest-tests:runs-on: ubuntu-latest- name: UI Tests (Puppeteer)+ name: All Pytest Tests + Coverageif: |github.event_name == 'pull_request' ||github.ref == 'refs/heads/main' ||@@ -291,9 +33,8 @@ jobs:egress-policy: audit- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1-with:- persist-credentials: false+ persist-credentials: true # Needed for gh-pages push- name: Set up Docker Buildxuses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3@@ -304,140 +45,35 @@ jobs:context: .target: ldr-testload: true- tags: ldr-test- cache-from: type=gha- cache-to: type=gha,mode=max+ tags: ${{ env.TEST_IMAGE }}+ cache-from: type=gha,scope=ldr-test+ cache-to: type=gha,mode=max,scope=ldr-test- - name: Install Node.js for UI tests+ - name: Set up Node.jsuses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version: '20'- - name: Install UI test dependencies- run: |- export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true- cd tests && npm ci-- - name: Start application server in Docker- run: |- docker run -d \- --name ldr-server \- -p 5000:5000 \- -e CI=true \- -e TEST_ENV=true \- -e FLASK_ENV=testing \- -e LDR_USE_FALLBACK_LLM=true \- -e DISABLE_RATE_LIMITING=true \- -e SECRET_KEY=test-secret-key-for-ci \- ldr-test ldr-web-- # Wait for server to be ready- for i in {1..60}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- if ! docker ps --filter "name=ldr-server" --filter "status=running" -q | grep -q .; then- echo "Server container died!"- echo "Server log:"- docker logs ldr-server- exit 1- fi- echo "Waiting for server... ($i/60)"- sleep 1- done-- # Final check- if ! curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server failed to start after 60 seconds"- echo "Server log:"- docker logs ldr-server- exit 1- fi-- - name: Register CI test user- run: |- docker run --rm \- -v "$PWD":/app \- -e CI=true \- --network host \- -w /app/tests/ui_tests \- ldr-test \- node register_ci_user.js http://localhost:5000-- - name: Run UI tests- run: |- docker run --rm \- -v "$PWD":/app \- -e LDR_USE_FALLBACK_LLM=true \- -e LDR_TESTING_WITH_MOCKS=true \- -e CI=true \- -e PUPPETEER_HEADLESS=true \- --network host \- -w /app/tests/ui_tests \- ldr-test \- sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js || node run_all_tests.js"-- - name: Stop server- if: always()+ - name: Install infrastructure test dependenciesrun: |- docker stop ldr-server || true- docker rm ldr-server || true-- - name: Upload UI test screenshots- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: ui-test-screenshots- path: |- tests/screenshots/- tests/ui_tests/screenshots/- # Code coverage report with GitHub Pages deployment- coverage-report:- runs-on: ubuntu-latest- name: Coverage Report- if: |- github.event_name == 'pull_request' ||- github.ref == 'refs/heads/main' ||- github.ref == 'refs/heads/dev'-- # Permissions needed for GitHub Pages deployment- permissions:- contents: write # For pushing to gh-pages branch- pull-requests: write # For PR comments-- env:- TEST_IMAGE: ldr-test- PAGES_URL: https://learningcircuit.github.io/local-deep-research/-- steps:- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1- with:- persist-credentials: true # Needed for gh-pages push-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3-- - name: Build Docker image with cache- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6- with:- context: .- target: ldr-test- load: true- tags: ${{ env.TEST_IMAGE }}- cache-from: type=gha,scope=ldr-test- cache-to: type=gha,mode=max,scope=ldr-test+ cd tests/infrastructure_tests && npm ci- - name: Run tests with coverage+ - name: Run all pytest tests with coverage# Continue even if some tests fail - we still want the coverage reportcontinue-on-error: true+ env:+ OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}run: |mkdir -p coveragedocker run --rm \-v "$PWD":/app \+ -e CI=true \+ -e GITHUB_ACTIONS=true \-e LDR_USE_FALLBACK_LLM=true \-e LDR_TESTING_WITH_MOCKS=true \+ -e DISABLE_RATE_LIMITING=true \-e PYTHONPATH=/app/src \+ -e OPENROUTER_API_KEY="${OPENROUTER_API_KEY}" \-w /app \${{ env.TEST_IMAGE }} \sh -c "python -m pytest tests/ \@@ -446,10 +82,16 @@ jobs:--cov-report=xml:coverage/coverage.xml \--cov-report=html:coverage/htmlcov \-v --tb=short \+ --durations=20 \+ -n auto \--ignore=tests/ui_tests \--ignore=tests/infrastructure_tests \--ignore=tests/fuzz"+ - name: Run JavaScript infrastructure tests+ run: |+ cd tests/infrastructure_tests && npm test+- name: Generate coverage summaryif: always()run: |diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.ymlindex 7b3800a31d..ad98916376 100644--- a/.github/workflows/ui-tests.yml+++ b/.github/workflows/ui-tests.yml@@ -2,15 +2,10 @@ name: UI Testson:push:- paths:- - 'src/local_deep_research/web/static/**'- - 'src/local_deep_research/web/templates/**'- - 'tests/ui_tests/**'+ branches: [ main, dev ]pull_request:types: [opened, synchronize, reopened]- schedule:- # Run UI tests nightly at 3 AM UTC- - cron: '0 3 * * *'+ branches: [ main, dev ]workflow_dispatch:permissions:@@ -19,12 +14,11 @@ permissions:jobs:ui-tests:runs-on: ubuntu-latest- name: UI/Browser Tests+ name: UI Tests (Puppeteer)if: |- github.event_name == 'push' ||- github.event_name == 'workflow_dispatch' ||- github.event_name == 'schedule' ||- (github.event_name == 'pull_request' && (github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'dev'))+ github.event_name == 'pull_request' ||+ github.ref == 'refs/heads/main' ||+ github.ref == 'refs/heads/dev'steps:- name: Harden the runner (Audit all outbound calls)@@ -37,80 +31,52 @@ jobs:with:persist-credentials: false- - name: Set up Python- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6- with:- python-version: '3.12'+ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3- - name: Set up Node.js+ - name: Build Docker image with cache+ uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6+ with:+ context: .+ target: ldr-test+ load: true+ tags: ldr-test+ cache-from: type=gha,scope=ldr-test+ cache-to: type=gha,mode=max,scope=ldr-test++ - name: Install Node.js for UI testsuses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.12'- cache: true-- - name: Install system dependencies for SQLCipher- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev-- - name: Install dependencies- run: |- # Install in development mode to ensure all modules are available- pdm sync -d- cd tests/ui_tests && npm ci-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}- - name: Install browser dependencies+ - name: Install UI test dependenciesrun: |- # Install Chrome for Puppeteer- npx puppeteer browsers install chrome+ export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true+ cd tests && npm ci- - name: Setup test directories- run: |- mkdir -p data/encrypted_databases- mkdir -p tests/ui_tests/screenshots- echo "Created data and screenshots directories for tests"-- - name: Start application server- env:- CI: true- TEST_ENV: true- FLASK_ENV: testing- LDR_USE_FALLBACK_LLM: true- LDR_DATA_DIR: ${{ github.workspace }}/data- DISABLE_RATE_LIMITING: true- SECRET_KEY: test-secret-key-for-ci- LDR_DB_KDF_ITERATIONS: "1000"+ - name: Start application server in Dockerrun: |- export PYTHONPATH=$PWD/src:$PYTHONPATH- echo "Starting web server with LDR_DATA_DIR=$LDR_DATA_DIR"- pdm run python -m local_deep_research.web.app 2>&1 | tee server.log &- echo $! > server.pid-- - name: Wait for server to be ready- run: |- # Wait up to 60 seconds for server to start+ docker run -d \+ --name ldr-server \+ -p 5000:5000 \+ -e CI=true \+ -e TEST_ENV=true \+ -e FLASK_ENV=testing \+ -e LDR_USE_FALLBACK_LLM=true \+ -e DISABLE_RATE_LIMITING=true \+ -e SECRET_KEY=test-secret-key-for-ci \+ ldr-test ldr-web++ # Wait for server to be readyfor i in {1..60}; doif curl -f http://localhost:5000/api/v1/health 2>/dev/null; thenecho "Server is ready after $i seconds"breakfi- if ! kill -0 "$(cat server.pid)" 2>/dev/null; then- echo "Server process died!"+ if ! docker ps --filter "name=ldr-server" --filter "status=running" -q | grep -q .; then+ echo "Server container died!"echo "Server log:"- cat server.log+ docker logs ldr-serverexit 1fiecho "Waiting for server... ($i/60)"@@ -121,39 +87,44 @@ jobs:if ! curl -f http://localhost:5000/api/v1/health 2>/dev/null; thenecho "Server failed to start after 60 seconds"echo "Server log:"- cat server.log+ docker logs ldr-serverexit 1fi- name: Register CI test user- working-directory: tests/ui_tests- run: node register_ci_user.js http://localhost:5000+ run: |+ docker run --rm \+ -v "$PWD":/app \+ -e CI=true \+ --network host \+ -w /app/tests/ui_tests \+ ldr-test \+ node register_ci_user.js http://localhost:5000- name: Run UI testsrun: |- export LDR_USE_FALLBACK_LLM=true- export DISPLAY=:99- export SKIP_FLAKY_TESTS=true- cd tests/ui_tests && xvfb-run -a -s "-screen 0 1920x1080x24" node run_all_tests.js+ docker run --rm \+ -v "$PWD":/app \+ -e LDR_USE_FALLBACK_LLM=true \+ -e LDR_TESTING_WITH_MOCKS=true \+ -e CI=true \+ -e PUPPETEER_HEADLESS=true \+ --network host \+ -w /app/tests/ui_tests \+ ldr-test \+ sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js || node run_all_tests.js"- - name: Upload UI test screenshots+ - name: Stop serverif: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: ui-test-screenshots- path: tests/ui_tests/screenshots/+ run: |+ docker stop ldr-server || true+ docker rm ldr-server || true- - name: Upload UI test results+ - name: Upload UI test screenshotsif: always()uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0with:- name: ui-test-results- path: tests/ui_tests/results/-- - name: Stop server- if: always()- run: |- if [ -f server.pid ]; then- kill "$(cat server.pid)" || true- rm server.pid- fi+ name: ui-test-screenshots+ path: |+ tests/screenshots/+ tests/ui_tests/screenshots/