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.

ci: consolidate 4 Docker-based test workflows into 1 (#1753)

LearningCircuitf77dfae84845
diff --git a/.github/workflows/pytest-tests.yml b/.github/workflows/docker-tests.yml
similarity index 51%
rename from .github/workflows/pytest-tests.yml
rename to .github/workflows/docker-tests.yml
index 5d36e0eea2..60bf6c36ca 100644
--- a/.github/workflows/pytest-tests.yml
+++ b/.github/workflows/docker-tests.yml
@@ -1,4 +1,4 @@
-name: Pytest Tests
+name: Docker Tests (Consolidated)
on:
pull_request:
@@ -16,12 +16,42 @@ env:
PAGES_URL: https://learningcircuit.github.io/local-deep-research/
jobs:
- pytest-tests:
+ # Detect which paths changed to conditionally run certain jobs
+ detect-changes:
runs-on: ubuntu-latest
- name: All Pytest Tests + Coverage
- permissions:
- contents: write # Needed for gh-pages deployment
- pull-requests: write # Needed for PR comments
+ outputs:
+ llm: ${{ steps.filter.outputs.llm }}
+ infrastructure: ${{ steps.filter.outputs.infrastructure }}
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
+ id: filter
+ with:
+ filters: |
+ llm:
+ - 'src/local_deep_research/llm/**'
+ - 'src/local_deep_research/config/llm_config.py'
+ - 'src/local_deep_research/api/research_functions.py'
+ - 'tests/test_llm/**'
+ - '.github/workflows/docker-tests.yml'
+ infrastructure:
+ - 'src/local_deep_research/web/routes/**'
+ - 'src/local_deep_research/web/static/js/**'
+ - 'tests/infrastructure_tests/**'
+ - '.github/workflows/docker-tests.yml'
+
+ # Build Docker image once and share via artifact
+ build-test-image:
+ runs-on: ubuntu-latest
+ name: Build Test Image
if: |
github.event_name == 'pull_request' ||
github.ref == 'refs/heads/main' ||
@@ -35,7 +65,7 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
- persist-credentials: true # Needed for gh-pages push
+ persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
@@ -45,12 +75,47 @@ jobs:
with:
context: .
target: ldr-test
- load: true
+ outputs: type=docker,dest=/tmp/ldr-test.tar
tags: ${{ env.TEST_IMAGE }}
# Cache poisoning protection: only read/write cache on trusted events (not PRs from forks)
cache-from: ${{ github.event_name != 'pull_request' && 'type=gha,scope=ldr-test' || '' }}
cache-to: ${{ github.event_name != 'pull_request' && 'type=gha,mode=max,scope=ldr-test' || '' }}
+ - name: Upload Docker image as artifact
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
+ with:
+ name: docker-image
+ path: /tmp/ldr-test.tar
+ retention-days: 1
+
+ # Run all pytest tests with coverage
+ pytest-tests:
+ runs-on: ubuntu-latest
+ name: All Pytest Tests + Coverage
+ needs: build-test-image
+ permissions:
+ contents: write # Needed for gh-pages deployment
+ pull-requests: write # Needed for PR comments
+
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: true # Needed for gh-pages push
+
+ - name: Download Docker image
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: docker-image
+ path: /tmp
+
+ - name: Load Docker image
+ run: docker load --input /tmp/ldr-test.tar
+
- name: Set up Node.js
# zizmor: ignore[cache-poisoning] - caching explicitly disabled with cache: ''
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
@@ -344,3 +409,319 @@ jobs:
-d "{\"files\":{\"coverage-badge.json\":{\"content\":$(jq -Rs . < coverage-badge.json)}}}"
fi
fi
+
+ # Run UI tests with Puppeteer
+ ui-tests:
+ runs-on: ubuntu-latest
+ name: UI Tests (Puppeteer)
+ needs: build-test-image
+ permissions:
+ contents: read
+
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+
+ - name: Download Docker image
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: docker-image
+ path: /tmp
+
+ - name: Load Docker image
+ run: docker load --input /tmp/ldr-test.tar
+
+ - name: Install Node.js for UI tests
+ # zizmor: ignore[cache-poisoning] - caching explicitly disabled with cache: ''
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
+ with:
+ node-version: '20'
+ # Cache poisoning protection: explicitly disable caching on PR events from forks
+ cache: ''
+
+ - 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 \
+ ${{ env.TEST_IMAGE }} 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 \
+ ${{ env.TEST_IMAGE }} \
+ 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 \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js || node run_all_tests.js"
+
+ - name: Stop server
+ if: always()
+ run: |
+ 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/
+
+ # Run LLM unit tests (conditional on path changes)
+ llm-unit-tests:
+ runs-on: ubuntu-latest
+ name: LLM Unit Tests
+ needs: [build-test-image, detect-changes]
+ if: needs.detect-changes.outputs.llm == 'true' || github.event_name == 'workflow_dispatch'
+ permissions:
+ contents: read
+
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+
+ - name: Download Docker image
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: docker-image
+ path: /tmp
+
+ - name: Load Docker image
+ run: docker load --input /tmp/ldr-test.tar
+
+ - name: Run LLM registry tests
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "python -m pytest tests/test_llm/test_llm_registry.py -v -n auto"
+
+ - name: Run LLM integration tests
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -e LDR_USE_FALLBACK_LLM=true \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "python -m pytest tests/test_llm/test_llm_integration.py -v -n auto"
+
+ - name: Run API LLM integration tests
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -e LDR_USE_FALLBACK_LLM=true \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "python -m pytest tests/test_llm/test_api_llm_integration.py -v -n auto"
+
+ - name: Run LLM edge case tests
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "python -m pytest tests/test_llm/test_llm_edge_cases.py -v -n auto"
+
+ - name: Run LLM benchmark tests
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "python -m pytest tests/test_llm/test_llm_benchmarks.py -v -n auto"
+
+ # Run LLM example tests (conditional on path changes)
+ llm-example-tests:
+ runs-on: ubuntu-latest
+ name: LLM Example Tests
+ needs: [build-test-image, detect-changes]
+ if: needs.detect-changes.outputs.llm == 'true' || github.event_name == 'workflow_dispatch'
+ permissions:
+ contents: read
+
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+
+ - name: Download Docker image
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: docker-image
+ path: /tmp
+
+ - name: Load Docker image
+ run: docker load --input /tmp/ldr-test.tar
+
+ - name: Test basic custom LLM example
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -e LDR_USE_FALLBACK_LLM=true \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "timeout 60s python examples/llm_integration/basic_custom_llm.py || true"
+
+ - name: Test mock LLM example
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -e LDR_USE_FALLBACK_LLM=true \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "timeout 60s python examples/llm_integration/mock_llm_example.py || true"
+
+ - name: Test provider switching example
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -e LDR_USE_FALLBACK_LLM=true \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "timeout 60s python examples/llm_integration/switch_providers.py || true"
+
+ - name: Test custom research example
+ run: |
+ docker run --rm \
+ -v "$PWD":/app \
+ -e PYTHONPATH=/app \
+ -e LDR_USE_FALLBACK_LLM=true \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "timeout 60s python examples/llm_integration/custom_research_example.py || true"
+
+ # Run infrastructure tests (conditional on path changes)
+ infrastructure-tests:
+ runs-on: ubuntu-latest
+ name: Infrastructure Tests
+ needs: [build-test-image, detect-changes]
+ if: needs.detect-changes.outputs.infrastructure == 'true' || github.event_name == 'workflow_dispatch'
+ permissions:
+ contents: read
+
+ 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+
+ - name: Download Docker image
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: docker-image
+ path: /tmp
+
+ - name: Load Docker image
+ run: docker load --input /tmp/ldr-test.tar
+
+ - 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 \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "cd /app && python -m pytest tests/infrastructure_tests/test_*.py -v --color=yes --no-header -rN"
+
+ - name: Run JavaScript infrastructure tests
+ run: |
+ cd tests/infrastructure_tests && npm test
+
+ - name: Upload test results
+ if: always()
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
+ with:
+ name: infrastructure-test-results
+ path: |
+ tests/infrastructure_tests/coverage/
+ tests/infrastructure_tests/test-results/
diff --git a/.github/workflows/infrastructure-tests.yml b/.github/workflows/infrastructure-tests.yml
deleted file mode 100644
index 9f8202babb..0000000000
--- a/.github/workflows/infrastructure-tests.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-name: Infrastructure Tests
-
-on:
- pull_request:
- paths:
- - 'src/local_deep_research/web/routes/**'
- - 'src/local_deep_research/web/static/js/config/**'
- - 'src/local_deep_research/web/static/js/security/**'
- - 'tests/infrastructure_tests/**'
- - '.github/workflows/infrastructure-tests.yml'
- workflow_dispatch:
-
-permissions:
- contents: read
-
-jobs:
- test:
- runs-on: ubuntu-latest
- name: Run 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
- with:
- persist-credentials: false
-
- - name: Build Docker image
- run: docker build --target ldr-test -t ldr-test .
-
- - 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 "cd /app && python -m pytest tests/infrastructure_tests/test_*.py -v --color=yes --no-header -rN"
-
- - name: Run JavaScript infrastructure tests
- run: |
- cd tests/infrastructure_tests && npm test
-
- - name: Upload test results
- if: always()
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
- with:
- name: infrastructure-test-results
- path: |
- tests/infrastructure_tests/coverage/
- tests/infrastructure_tests/test-results/
diff --git a/.github/workflows/llm-tests.yml b/.github/workflows/llm-tests.yml
deleted file mode 100644
index 51d5b6b4fa..0000000000
--- a/.github/workflows/llm-tests.yml
+++ /dev/null
@@ -1,159 +0,0 @@
-name: LLM Integration Tests
-
-on:
- pull_request:
- branches: [ main, dev ]
- paths:
- - 'src/local_deep_research/llm/**'
- - 'src/local_deep_research/config/llm_config.py'
- - 'src/local_deep_research/api/research_functions.py'
- - 'tests/test_llm/**'
- - '.github/workflows/llm-tests.yml'
- workflow_dispatch:
-
-permissions:
- contents: read
-
-jobs:
- llm-unit-tests:
- runs-on: ubuntu-latest
- name: LLM Unit 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
- 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 registry tests
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -w /app \
- ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_registry.py -v -n auto"
-
- - name: Run LLM integration tests
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -e LDR_USE_FALLBACK_LLM=true \
- -w /app \
- ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_integration.py -v -n auto"
-
- - name: Run API LLM integration tests
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -e LDR_USE_FALLBACK_LLM=true \
- -w /app \
- ldr-test \
- sh -c "python -m pytest tests/test_llm/test_api_llm_integration.py -v -n auto"
-
- - name: Run LLM edge case tests
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -w /app \
- ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_edge_cases.py -v -n auto"
-
- - name: Run LLM benchmark tests
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -w /app \
- ldr-test \
- sh -c "python -m pytest tests/test_llm/test_llm_benchmarks.py -v -n auto"
-
- llm-example-tests:
- runs-on: ubuntu-latest
- name: LLM Example 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
- 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: Test basic custom LLM example
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -e LDR_USE_FALLBACK_LLM=true \
- -w /app \
- ldr-test \
- sh -c "timeout 60s python examples/llm_integration/basic_custom_llm.py || true"
-
- - name: Test mock LLM example
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -e LDR_USE_FALLBACK_LLM=true \
- -w /app \
- ldr-test \
- sh -c "timeout 60s python examples/llm_integration/mock_llm_example.py || true"
-
- - name: Test provider switching example
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -e LDR_USE_FALLBACK_LLM=true \
- -w /app \
- ldr-test \
- sh -c "timeout 60s python examples/llm_integration/switch_providers.py || true"
-
- - name: Test custom research example
- run: |
- docker run --rm \
- -v "$PWD":/app \
- -e PYTHONPATH=/app \
- -e LDR_USE_FALLBACK_LLM=true \
- -w /app \
- ldr-test \
- sh -c "timeout 60s python examples/llm_integration/custom_research_example.py || true"
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
deleted file mode 100644
index 16d3724319..0000000000
--- a/.github/workflows/ui-tests.yml
+++ /dev/null
@@ -1,132 +0,0 @@
-name: UI Tests
-
-on:
- pull_request:
- types: [opened, synchronize, reopened]
- branches: [ main, dev ]
- workflow_dispatch:
-
-permissions:
- contents: read
-
-jobs:
- ui-tests:
- runs-on: ubuntu-latest
- name: UI Tests (Puppeteer)
- 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
- 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 poisoning protection: only read/write cache on trusted events (not PRs from forks)
- cache-from: ${{ github.event_name != 'pull_request' && 'type=gha,scope=ldr-test' || '' }}
- cache-to: ${{ github.event_name != 'pull_request' && 'type=gha,mode=max,scope=ldr-test' || '' }}
-
- - name: Install Node.js for UI tests
- # zizmor: ignore[cache-poisoning] - caching explicitly disabled with cache: ''
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- with:
- node-version: '20'
- # Cache poisoning protection: explicitly disable caching on PR events from forks
- cache: ''
-
- - 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()
- run: |
- 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/
diff --git a/docs/CI_CD_INFRASTRUCTURE.md b/docs/CI_CD_INFRASTRUCTURE.md
index 593f67c82c..0927ba978f 100644
--- a/docs/CI_CD_INFRASTRUCTURE.md
+++ b/docs/CI_CD_INFRASTRUCTURE.md
@@ -82,16 +82,13 @@ pre-commit install-hooks
| Workflow | Trigger | Purpose |
|----------|---------|---------|
-| `tests.yml` | PR, push | Main test suite (unit, integration, coverage) |
+| `docker-tests.yml` | PR, push | Consolidated Docker tests: pytest + coverage, UI tests, LLM tests, infrastructure tests (single Docker build shared across all jobs) |
| `api-tests.yml` | PR, push | API endpoint testing |
-| `ui-tests.yml` | PR, push | Puppeteer UI tests |
| `critical-ui-tests.yml` | PR, push | Essential UI flow tests |
| `extended-ui-tests.yml` | PR, push | Extended UI validation |
| `e2e-research-test.yml` | PR, push | End-to-end research flow |
-| `infrastructure-tests.yml` | PR, push | Infrastructure validation |
-| `library-tests.yml` | PR, push | Research library tests |
+| `library-ui-tests.yml` | PR, push | Research library UI tests |
| `news-tests.yml` | PR, push | News subscription tests |
-| `llm-tests.yml` | PR, push | LLM provider tests |
| `metrics-analytics-tests.yml` | PR, push | Analytics tests |
| `performance-tests.yml` | PR, push | Performance benchmarks |
| `followup-research-tests.yml` | PR, push | Follow-up research tests |
@@ -184,7 +181,7 @@ Dependabot automatically creates PRs for dependency updates:
## Coverage Reporting
-Coverage reports are generated by the `tests.yml` workflow:
+Coverage reports are generated by the `docker-tests.yml` workflow (pytest-tests job):
- **HTML Report**: Deployed to GitHub Pages at `https://learningcircuit.github.io/local-deep-research/coverage/`
- **PR Comments**: Each PR receives a comment with coverage percentage