From 209dadc0af09f21f757f74f63ce1fd7740958f35 Mon Sep 17 00:00:00 2001 From: BukeLy Date: Wed, 19 Nov 2025 23:34:45 +0800 Subject: [PATCH] ci: add feature branch testing workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why this change is needed: Before creating a PR, we need to validate that the vector storage model isolation feature works correctly in the CI environment. The existing tests.yml only runs on main/dev branches and only tests marked as 'offline'. We need a dedicated workflow to test feature branches and specifically run migration tests. What this adds: - New workflow: feature-tests.yml - Triggers on: 1. Manual dispatch (workflow_dispatch) - can be triggered from GitHub UI 2. Push to feature/** branches - automatic testing 3. Pull requests to main/dev - pre-merge validation - Runs migration tests across Python 3.10, 3.11, 3.12 - Specifically tests: - test_qdrant_migration.py (6 tests) - test_postgres_migration.py (6 tests) - Uploads test results as artifacts How to use: 1. Automatic: Push to feature/vector-model-isolation triggers tests 2. Manual: Go to Actions tab → Feature Branch Tests → Run workflow 3. PR: Tests run automatically when PR is created Impact: - Enables pre-PR validation on GitHub infrastructure - Catches issues before code review - Provides test results across multiple Python versions - No need for local test environment setup Testing: After pushing this commit, tests will run automatically on the feature branch. Can also be triggered manually from GitHub Actions UI. --- .github/workflows/feature-tests.yml | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/feature-tests.yml diff --git a/.github/workflows/feature-tests.yml b/.github/workflows/feature-tests.yml new file mode 100644 index 00000000..f46ebcf3 --- /dev/null +++ b/.github/workflows/feature-tests.yml @@ -0,0 +1,74 @@ +name: Feature Branch Tests + +on: + workflow_dispatch: # Allow manual trigger + push: + branches: + - 'feature/**' + pull_request: + branches: [ main, dev ] + +jobs: + migration-tests: + name: Vector Storage Migration Tests + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip packages + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[api]" + pip install pytest pytest-asyncio + + - name: Run Qdrant migration tests + run: | + pytest tests/test_qdrant_migration.py -v --tb=short + continue-on-error: false + + - name: Run PostgreSQL migration tests + run: | + pytest tests/test_postgres_migration.py -v --tb=short + continue-on-error: false + + - name: Run all unit tests (if exists) + run: | + # Run EmbeddingFunc tests + pytest tests/ -k "embedding" -v --tb=short || true + continue-on-error: true + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: migration-test-results-py${{ matrix.python-version }} + path: | + .pytest_cache/ + test-results.xml + retention-days: 7 + + - name: Test Summary + if: always() + run: | + echo "## Test Summary" >> $GITHUB_STEP_SUMMARY + echo "- Python: ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY + echo "- Branch: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY + echo "- Commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY