Skip to content

Merge branch 'develop' #165

Merge branch 'develop'

Merge branch 'develop' #165

Workflow file for this run

name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
# Skip tests for automated version-strip commits (version-only changes)
if: |
!(github.actor == 'github-actions[bot]' &&
contains(github.event.head_commit.message || '', 'strip dev suffix'))
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install ruff
- name: Run ruff check
run: ruff check .
- name: Run ruff format check
run: ruff format --check .
unit-tests:
name: Unit Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
# Skip tests for automated version-strip commits (version-only changes)
if: |
!(github.actor == 'github-actions[bot]' &&
contains(github.event.head_commit.message || '', 'strip dev suffix'))
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install uv
uv pip install --system ".[dev]"
- name: Run unit tests
run: |
pytest tests/ -v --cov=src --cov-report=xml --cov-report=term \
-m "not integration and not llm and not network"
- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
# Run on push to main or workflow_dispatch, but not on PRs (to save API costs)
# Skip for automated version-strip commits (version-only changes)
if: |
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
!(github.actor == 'github-actions[bot]' &&
contains(github.event.head_commit.message || '', 'strip dev suffix'))
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install uv
uv pip install --system ".[dev]"
- name: Check for API key
id: check-key
run: |
if [ -n "${{ secrets.OPENROUTER_API_KEY }}" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "::warning::OPENROUTER_API_KEY not set - skipping integration tests"
fi
- name: Run integration tests
if: steps.check-key.outputs.has_key == 'true'
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
run: |
pytest tests/ -v -m "integration or llm" --tb=short
- name: Run network tests
env:
GITHUB_TOKEN: ${{ secrets.READ_GITHUB_TOKEN }} # read-only PAT for API rate limits
run: |
pytest tests/ -v -m "network" --tb=short
continue-on-error: true
all-tests:
name: All Tests Passed
needs: [lint, unit-tests]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check results
run: |
# Skipped tests (for bot version-strip commits) count as success
if [ "${{ needs.lint.result }}" != "success" ] && [ "${{ needs.lint.result }}" != "skipped" ]; then
echo "Lint failed"
exit 1
fi
if [ "${{ needs.unit-tests.result }}" != "success" ] && [ "${{ needs.unit-tests.result }}" != "skipped" ]; then
echo "Unit tests failed"
exit 1
fi
echo "All required tests passed"