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.

feat: enhance CI pipeline with comprehensive testing strategy

LearningCircuit38fc6171c437
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000000..87318a6e97
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,23 @@
+# Code Owners for Local Deep Research
+# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
+
+# Global owners - these people are automatically requested for review on all PRs
+# and their approval is required for merging to protected branches
+* @LearningCircuit @hashedviking @djpetti
+
+# Critical infrastructure and release files require maintainer approval
+/.github/ @LearningCircuit @hashedviking @djpetti
+/pyproject.toml @LearningCircuit @hashedviking @djpetti
+/Dockerfile @LearningCircuit @hashedviking @djpetti
+/src/local_deep_research/__version__.py @LearningCircuit @hashedviking @djpetti
+
+# CI/CD workflows and release automation
+/.github/workflows/ @LearningCircuit @hashedviking @djpetti
+
+# Core API and configuration changes
+/src/local_deep_research/api/ @LearningCircuit @hashedviking @djpetti
+/src/local_deep_research/config/ @LearningCircuit @hashedviking @djpetti
+
+# Database migrations and metrics (sensitive for data integrity)
+/src/local_deep_research/metrics/ @LearningCircuit @hashedviking @djpetti
+/src/local_deep_research/migrate*.py @LearningCircuit @hashedviking @djpetti
diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml
index 91001421c8..8200063d60 100644
--- a/.github/workflows/api-tests.yml
+++ b/.github/workflows/api-tests.yml
@@ -7,16 +7,17 @@ on:
- 'src/local_deep_research/web/routes/**'
- 'tests/api_tests/**'
pull_request:
- paths:
- - 'src/local_deep_research/api/**'
- - 'src/local_deep_research/web/routes/**'
- - 'tests/api_tests/**'
+ types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
api-tests:
runs-on: ubuntu-latest
name: REST API Tests
+ if: |
+ github.event_name == 'push' ||
+ github.event_name == 'workflow_dispatch' ||
+ (github.event_name == 'pull_request' && (github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'dev'))
services:
# Add any external services the API needs for testing
@@ -44,15 +45,11 @@ jobs:
pdm install
pdm install -d
- - name: Run API health checks
- run: |
- cd tests/health_check && python test_endpoints_health.py
-
- name: Run API unit tests
run: |
pdm run pytest tests/api_tests/ -v --cov=src/local_deep_research/api --cov-report=term
- - name: Run API integration tests
+ - name: Run API integration tests with health checks
run: |
# Start server in background for API testing
pdm run ldr-web &
@@ -61,15 +58,18 @@ jobs:
# Wait for server to start
sleep 10
+ # Run health checks
+ cd tests/health_check && pdm run python test_endpoints_health.py
+
# Run API tests
- cd tests/api_tests && python test_rest_api.py
+ cd tests/api_tests && pdm run python test_rest_api.py
# Clean up
kill $SERVER_PID || true
- name: Upload API test results
if: always()
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: api-test-results
path: tests/api_tests/results/
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f456d0f92d..14b8682da9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,36 +1,117 @@
-name: Release
+name: Create Release
on:
push:
branches:
- - main
-
-permissions:
- contents: write
+ - main # Automatically create release when merging to main
+ tags:
+ - 'v*.*.*' # Also support manual version tags
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'Version to release (e.g., 0.4.3)'
+ required: true
+ type: string
+ prerelease:
+ description: 'Mark as pre-release'
+ required: false
+ type: boolean
+ default: false
jobs:
- release:
+ create-release:
runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ pull-requests: read
+
steps:
- - uses: actions/checkout@v3
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Fetch full history for changelog generation
- - name: Get version
+ - name: Determine version
id: version
run: |
- echo "VERSION=$(python -c 'exec(open("src/local_deep_research/__version__.py").read()); print(__version__)')" >> $GITHUB_OUTPUT
+ if [ "${{ github.event_name }}" == "push" ] && [[ "${{ github.ref }}" == refs/tags/* ]]; then
+ # Extract version from tag (remove 'v' prefix)
+ VERSION=${GITHUB_REF#refs/tags/v}
+ elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then
+ # Get version from __version__.py for main branch pushes
+ VERSION=$(grep -oP '(?<=__version__ = ")[^"]*' src/local_deep_research/__version__.py)
+ else
+ # Use manual input
+ VERSION="${{ github.event.inputs.version }}"
+ fi
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "tag=v$VERSION" >> $GITHUB_OUTPUT
+
+ - name: Check if release already exists
+ id: check_release
+ run: |
+ if gh release view "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
+ echo "Release ${{ steps.version.outputs.tag }} already exists, skipping..."
+ echo "exists=true" >> $GITHUB_OUTPUT
+ else
+ echo "Release ${{ steps.version.outputs.tag }} does not exist, proceeding..."
+ echo "exists=false" >> $GITHUB_OUTPUT
+ fi
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Verify version matches __version__.py
+ if: steps.check_release.outputs.exists == 'false'
+ run: |
+ VERSION_FILE_VERSION=$(grep -oP '(?<=__version__ = ")[^"]*' src/local_deep_research/__version__.py)
+ if [ "$VERSION_FILE_VERSION" != "${{ steps.version.outputs.version }}" ]; then
+ echo "Error: Version mismatch!"
+ echo "Tag/input version: ${{ steps.version.outputs.version }}"
+ echo "__version__.py version: $VERSION_FILE_VERSION"
+ exit 1
+ fi
+ echo "Version verified: ${{ steps.version.outputs.version }}"
- - name: Create tag
+ - name: Generate changelog
+ if: steps.check_release.outputs.exists == 'false'
+ id: changelog
run: |
- git config user.name github-actions
- git config user.email [email protected]
- git tag -a v${{ steps.version.outputs.VERSION }} -m "Release v${{ steps.version.outputs.VERSION }}"
- git push origin v${{ steps.version.outputs.VERSION }}
+ # Get the previous tag
+ PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
- - name: Create Release
- uses: softprops/action-gh-release@v1
+ if [ -z "$PREVIOUS_TAG" ]; then
+ echo "No previous tag found, generating changelog from all commits"
+ COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges)
+ else
+ echo "Generating changelog since $PREVIOUS_TAG"
+ COMMITS=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
+ fi
+
+ # Create changelog content
+ cat > changelog.md << EOF
+ ## What's Changed
+
+ $COMMITS
+
+ **Full Changelog**: https://github.com/LearningCircuit/local-deep-research/compare/${PREVIOUS_TAG}...${{ steps.version.outputs.tag }}
+ EOF
+
+ echo "changelog_file=changelog.md" >> $GITHUB_OUTPUT
+
+ - name: Create GitHub Release
+ if: steps.check_release.outputs.exists == 'false'
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- tag_name: v${{ steps.version.outputs.VERSION }}
- name: Release v${{ steps.version.outputs.VERSION }}
+ tag_name: ${{ steps.version.outputs.tag }}
+ release_name: Release ${{ steps.version.outputs.version }}
+ body_path: changelog.md
draft: false
- prerelease: false
- token: ${{ secrets.GITHUB_TOKEN }}
+ prerelease: ${{ github.event.inputs.prerelease == 'true' }}
+
+ - name: Summary
+ run: |
+ echo "🎉 Release ${{ steps.version.outputs.version }} created successfully!"
+ echo "📋 This will trigger PyPI and Docker publishing workflows"
+ echo "🔍 Check the releases page: https://github.com/LearningCircuit/local-deep-research/releases"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 270e6bd0be..c4e6343dae 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -4,6 +4,7 @@ on:
push:
branches: [ main, dev ]
pull_request:
+ types: [opened, synchronize, reopened]
branches: [ main, dev ]
workflow_dispatch:
@@ -31,48 +32,15 @@ jobs:
- name: Run unit tests only
run: |
- cd tests && python run_all_tests.py unit-only
+ cd tests && pdm run python run_all_tests.py unit-only
- # Standard tests for PRs and main branch
- integration-tests:
- runs-on: ubuntu-latest
- name: Integration Tests
- needs: unit-tests
- if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Set up Python
- uses: actions/setup-python@v4
- with:
- python-version: '3.11'
-
- - name: Set up PDM
- uses: pdm-project/setup-pdm@v4
-
- - name: Install dependencies
- run: |
- pdm install
- pdm install -d
-
- - name: Run CI test profile
- run: |
- cd tests && python run_all_tests.py ci
-
- - name: Upload test results
- if: always()
- uses: actions/upload-artifact@v3
- with:
- name: test-results
- path: tests/test_results.json
-
- # Full tests for main branch only
+ # Full tests for PRs to main/dev branches and main branch pushes
full-tests:
runs-on: ubuntu-latest
name: Full Test Suite
- needs: [unit-tests, integration-tests]
- if: github.ref == 'refs/heads/main'
+ if: |
+ github.event_name == 'pull_request' ||
+ github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
@@ -98,13 +66,13 @@ jobs:
- name: Install UI test dependencies
run: npm install
- - name: Run full test suite
+ - name: Run full test suite (including UI and API tests)
run: |
- cd tests && python run_all_tests.py full
+ cd tests && pdm run python run_all_tests.py full
- name: Upload test results and screenshots
if: always()
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: full-test-results
path: |
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
index 31b15a5d66..75f7fb6c62 100644
--- a/.github/workflows/ui-tests.yml
+++ b/.github/workflows/ui-tests.yml
@@ -7,10 +7,7 @@ on:
- 'src/local_deep_research/web/templates/**'
- 'tests/ui_tests/**'
pull_request:
- paths:
- - 'src/local_deep_research/web/static/**'
- - 'src/local_deep_research/web/templates/**'
- - 'tests/ui_tests/**'
+ types: [opened, synchronize, reopened]
schedule:
# Run UI tests nightly at 3 AM UTC
- cron: '0 3 * * *'
@@ -20,6 +17,11 @@ jobs:
ui-tests:
runs-on: ubuntu-latest
name: UI/Browser Tests
+ 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'))
steps:
- uses: actions/checkout@v4
@@ -71,14 +73,14 @@ jobs:
- name: Upload UI test screenshots
if: always()
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: ui-test-screenshots
path: tests/ui_tests/screenshots/
- name: Upload UI test results
if: always()
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: ui-test-results
path: tests/ui_tests/results/
diff --git a/.github/workflows/version_check.yml b/.github/workflows/version_check.yml
index 45f0b11b4b..e31e609bef 100644
--- a/.github/workflows/version_check.yml
+++ b/.github/workflows/version_check.yml
@@ -22,9 +22,39 @@ jobs:
with:
python-version: '3.13.2'
- - name: Check version update
+ - name: Check and auto-bump version
run: |
if ! git diff origin/${{ github.base_ref }}..HEAD -G"__version__" | grep -E '\+.*__version__.*='; then
- echo "Error: Version must be updated in __version__.py."
- exit 1
+ echo "Version not updated. Auto-bumping patch version..."
+
+ # Get current version
+ current_version=$(grep -oP '(?<=__version__ = ")[^"]*' src/local_deep_research/__version__.py)
+ echo "Current version: $current_version"
+
+ # Split version into parts
+ IFS='.' read -ra VERSION_PARTS <<< "$current_version"
+ major=${VERSION_PARTS[0]}
+ minor=${VERSION_PARTS[1]}
+ patch=${VERSION_PARTS[2]}
+
+ # Increment patch version
+ new_patch=$((patch + 1))
+ new_version="$major.$minor.$new_patch"
+ echo "New version: $new_version"
+
+ # Update version file
+ sed -i "s/__version__ = \"$current_version\"/__version__ = \"$new_version\"/" src/local_deep_research/__version__.py
+
+ # Configure git
+ git config --local user.email "[email protected]"
+ git config --local user.name "GitHub Action"
+
+ # Commit the version bump
+ git add src/local_deep_research/__version__.py
+ git commit -m "chore: auto-bump version to $new_version"
+ git push
+
+ echo "Version automatically bumped to $new_version"
+ else
+ echo "Version has been updated manually. No auto-bump needed."
fi
diff --git a/docs/RELEASE_GUIDE.md b/docs/RELEASE_GUIDE.md
new file mode 100644
index 0000000000..eab443542d
--- /dev/null
+++ b/docs/RELEASE_GUIDE.md
@@ -0,0 +1,84 @@
+# Release Guide
+
+## 🚀 Automated Release Process
+
+Releases are now **fully automated** when PRs are merged to the `main` branch.
+
+## 📋 How Releases Work
+
+### 1. **Automatic Release Creation**
+- **Trigger**: Any merge to `main` branch
+- **Version**: Automatically uses version from `src/local_deep_research/__version__.py`
+- **Changelog**: Auto-generated from commit history since last release
+- **No duplicates**: Skips if release already exists for that version
+
+### 2. **Automatic Publishing** (with approval)
+- **GitHub Release** → triggers:
+ - **PyPI publishing** (requires `release` environment approval)
+ - **Docker publishing** (requires `release` environment approval)
+
+## 👥 Who Can Release
+
+Code owners (defined in `.github/CODEOWNERS`):
+- `@LearningCircuit`
+- `@hashedviking`
+- `@djpetti`
+
+## 📝 Release Workflow
+
+### For Regular Releases:
+
+1. **Create PR** with your changes
+2. **Update version** in `src/local_deep_research/__version__.py`
+3. **Get approval** from code owners
+4. **Merge to main** → Release automatically created
+5. **Approve publishing** in GitHub Actions (PyPI/Docker)
+
+### For Hotfixes:
+
+1. **Create hotfix branch** from main
+2. **Make minimal fix**
+3. **Bump patch version** (e.g., 0.4.3 → 0.4.4)
+4. **Fast-track review** by code owners
+5. **Merge to main** → Automatic release
+
+## 🔧 Manual Release Options
+
+### Option A: Manual Trigger
+- Go to Actions → "Create Release" → "Run workflow"
+- Specify version and prerelease flag
+
+### Option B: Version Tags
+- `git tag v0.4.3 && git push origin v0.4.3`
+- Automatically creates release
+
+## 🛡️ Branch Protection
+
+- **Main branch** is protected
+- **Required reviews** from code owners
+- **No direct pushes** - only via approved PRs
+- **Status checks** must pass (CI tests)
+
+## 📦 Version Numbering
+
+Follow [Semantic Versioning](https://semver.org/):
+- **Major** (X.0.0): Breaking changes
+- **Minor** (0.X.0): New features, backward compatible
+- **Patch** (0.0.X): Bug fixes, backward compatible
+
+## 🚨 Emergency Procedures
+
+If automation fails:
+1. **Manual GitHub release** still triggers PyPI/Docker
+2. **Contact code owners** for assistance
+3. **Check workflow logs** in GitHub Actions
+
+## 📊 Release Checklist
+
+- [ ] Version updated in `__version__.py`
+- [ ] Changes tested in PR
+- [ ] Code owner approval received
+- [ ] CI tests passing
+- [ ] Merge to main completed
+- [ ] Release automatically created
+- [ ] PyPI/Docker publishing approved
diff --git a/tests/run_all_tests.py b/tests/run_all_tests.py
index a27ea37635..5730d9eee2 100755
--- a/tests/run_all_tests.py
+++ b/tests/run_all_tests.py
@@ -192,8 +192,8 @@ class TestRunner:
return self.run_command(
[
- sys.executable,
- "-m",
+ "pdm",
+ "run",
"pytest",
"-v",
"tests/test_settings_manager.py",