Skip to content

feat: initialize Task 3 - Enhanced Semantic Search Capabilities #128

feat: initialize Task 3 - Enhanced Semantic Search Capabilities

feat: initialize Task 3 - Enhanced Semantic Search Capabilities #128

Workflow file for this run

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:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
test-type: [unit] # Temporarily focus on unit tests until database issues are resolved
env:
ENVIRONMENT: ci
PYTHONUNBUFFERED: 1
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
shell: bash
run: |
echo "Installing dependencies..."
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov pytest-timeout pytest-asyncio pytest-xdist pytest-json-report
- name: Select tests by marker
id: select-tests
shell: bash
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
shell: bash
run: |
echo "Running tests with Python..."
if [[ -n "$PYTEST_MARK" ]]; then
python -m pytest tests/ -m "$PYTEST_MARK" --json-report --json-report-file=pytest-${{ matrix.test-type }}.json -v
else
python -m pytest tests/ --json-report --json-report-file=pytest-${{ matrix.test-type }}.json -v
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
shell: bash
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 }}
shell: bash
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."}'