name: Tests on: push: branches: [ main, develop ] pull_request: branches: [ main ] jobs: test: 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@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run unit tests run: | # Run all tests except live integration tests # These tests use mocks and don't require API keys python -m pytest tests/ --ignore=tests/test_live_integration.py -v --cov=. --cov-report=xml env: # Ensure no API key is accidentally used in CI GEMINI_API_KEY: "" - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: file: ./coverage.xml fail_ci_if_error: true lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install ruff black - name: Run black formatter check run: black --check . - name: Run ruff linter run: ruff check . live-tests: runs-on: ubuntu-latest # Only run live tests if API key secret is available if: github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.GEMINI_API_KEY != '' steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run live integration tests run: | # Run live tests that make actual API calls python tests/test_live_integration.py env: GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}