feat: initialize Task 3 - Enhanced Semantic Search Capabilities #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Matrix | ||
| on: | ||
| push: | ||
| branches: [main, development] | ||
| paths-ignore: | ||
| - '**.md' | ||
| - '**/docs/**' | ||
| pull_request: | ||
| branches: [main, development] | ||
| paths-ignore: | ||
| - '**.md' | ||
| - '**/docs/**' | ||
| workflow_dispatch: | ||
| jobs: | ||
| test-matrix: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12"] | ||
| test-type: [unit, integration, e2e] | ||
| env: | ||
| ENVIRONMENT: ci | ||
| PYTHONUNBUFFERED: 1 | ||
| PIXI_ENV: ci | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup pixi with cache (attempt 1) | ||
| id: setup-pixi-cache | ||
| uses: prefix-dev/setup-pixi@v0.8.1 | ||
| with: | ||
| pixi-version: v0.49.0 | ||
| cache: true | ||
| continue-on-error: true | ||
| - name: Verify Pixi installation or install manually if cache failed | ||
| if: steps.setup-pixi-cache.outcome == 'failure' || (runner.os == 'Windows' && !contains(env.PATH, '.pixi\\bin')) || (runner.os != 'Windows' && !command -v pixi) | ||
|
Check failure on line 39 in .github/workflows/test-matrix.yml
|
||
| run: | | ||
| echo "Pixi not found on PATH or setup-pixi-cache failed. Attempting manual installation." | ||
| if [ "${{ runner.os }}" == "Windows" ]; then | ||
| curl -L -o pixi.exe https://github.com/prefix-dev/pixi/releases/download/v0.49.0/pixi-x86_64-pc-windows-msvc.exe | ||
| mkdir -p "$HOME/.pixi/bin" | ||
| mv pixi.exe "$HOME/.pixi/bin/" | ||
| echo "$HOME/.pixi/bin" >> $GITHUB_PATH | ||
| else | ||
| curl -fsSL https://pixi.sh/install.sh | bash | ||
| echo "$HOME/.pixi/bin" >> $GITHUB_PATH | ||
| fi | ||
| echo "Pixi installed manually." | ||
| - name: Activate pixi environment and install dependencies (with retry) | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| if ! command -v pixi &> /dev/null; then | ||
| echo "Error: pixi command not found after activation. Environment setup failed." | ||
| exit 1 | ||
| fi | ||
| echo "Attempting to install pixi dependencies..." | ||
| n=0 | ||
| until [ "$n" -ge 3 ] | ||
| do | ||
| pixi install --locked && break | ||
| n=$((n+1)) | ||
| echo "pixi install failed, retrying ($n/3)..." | ||
| sleep 5 | ||
| done | ||
| if [ "$n" -ge 3 ]; then | ||
| echo "Failed to install dependencies after multiple retries." | ||
| exit 1 | ||
| fi | ||
| - name: Activate pixi environment and install dev dependencies (robust) | ||
| # This step is specific to test-matrix.yml and installs optional dev dependencies. | ||
| # It should also be robust. | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| if ! command -v pip &> /dev/null; then | ||
| echo "Error: pip command not found after activation. Python environment not set up correctly." | ||
| exit 1 | ||
| fi | ||
| echo "Attempting to install dev dependencies..." | ||
| n=0 | ||
| until [ "$n" -ge 3 ] | ||
| do | ||
| pip install -e .[dev,mcp,ml] && break | ||
| n=$((n+1)) | ||
| echo "pip install -e .[dev,mcp,ml] failed, retrying ($n/3)..." | ||
| sleep 5 | ||
| done | ||
| if [ "$n" -ge 3 ]; then | ||
| echo "Failed to install dev dependencies after multiple retries." | ||
| exit 1 | ||
| fi | ||
| - name: Verify pixi environment | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| which python | ||
| which pip | ||
| python --version | ||
| pip --version | ||
| - name: Select tests by marker | ||
| id: select-tests | ||
| run: | | ||
| if [[ "${{ matrix.test-type }}" == "unit" ]]; then | ||
| echo "PYTEST_MARK=unit" >> $GITHUB_ENV | ||
| elif [[ "${{ matrix.test-type }}" == "integration" ]]; then | ||
| echo "PYTEST_MARK=integration" >> $GITHUB_ENV | ||
| elif [[ "${{ matrix.test-type }}" == "e2e" ]]; then | ||
| echo "PYTEST_MARK=e2e" >> $GITHUB_ENV | ||
| fi | ||
| - name: Run selected tests (with pixi shell activation) | ||
| run: | | ||
| eval "$(pixi shell --env-hook bash)" | ||
| which pytest || (echo "pytest not found!"; exit 127) | ||
| pytest --version | ||
| if [[ -n "$PYTEST_MARK" ]]; then | ||
| pytest tests/ -m "$PYTEST_MARK" --json-report --json-report-file=pytest-${{ matrix.test-type }}.json | ||
| else | ||
| pytest tests/ --json-report --json-report-file=pytest-${{ matrix.test-type }}.json | ||
| fi | ||
| - name: Upload test results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results-${{ matrix.python-version }}-${{ matrix.test-type }} | ||
| path: pytest-${{ matrix.test-type }}.json | ||
| aggregate-results: | ||
| needs: test-matrix | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| path: ./artifacts | ||
| - name: Aggregate and compare test results | ||
| run: | | ||
| find ./artifacts -name "*.json" -exec cat {} + > all-results.json | ||
| # Optionally, add custom aggregation/comparison logic here | ||
| - name: Upload aggregated results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: aggregated-test-results | ||
| path: all-results.json | ||
| - name: Notify Results (GitHub API) | ||
| if: always() | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| curl -X POST \ | ||
| -H "Authorization: token $GITHUB_TOKEN" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | ||
| -d '{"state": "success", "context": "Test Matrix", "description": "Matrix tests complete."}' | ||