name: Test Suite on: push: branches: [ main, claude/** ] pull_request: branches: [ main ] jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ['3.9', '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 dependencies uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run tests with pytest run: | pytest tests/ -v --cov=. --cov-report=xml --cov-report=term-missing - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: file: ./coverage.xml flags: unittests name: codecov-umbrella fail_ci_if_error: false - name: Generate coverage badge if: matrix.python-version == '3.11' run: | pip install coverage-badge coverage-badge -o coverage.svg -f - name: Archive coverage reports if: matrix.python-version == '3.11' uses: actions/upload-artifact@v4 with: name: coverage-reports path: | htmlcov/ coverage.xml coverage.svg lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install linting tools run: | python -m pip install --upgrade pip pip install flake8 black isort - name: Check code formatting with Black run: | black --check . || echo "Black formatting check failed - run 'black .' to fix" continue-on-error: true - name: Check import sorting with isort run: | isort --check-only . || echo "Import sorting check failed - run 'isort .' to fix" continue-on-error: true - name: Lint with flake8 run: | # Stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # Exit-zero treats all errors as warnings flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics continue-on-error: true