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@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Run linting
run: |
pip install black isort flake8
flake8 src tests --max-line-length=88 --extend-ignore=E203,W503
isort --check-only src tests
black --check src tests
- name: Run unit tests
run: |
pytest -m "not integration and not performance" --cov=semantic_scholar_mcp --cov-report=xml
- name: Run integration tests
if: ${{ env.SEMANTIC_SCHOLAR_API_KEY != '' }}
env:
SEMANTIC_SCHOLAR_API_KEY: ${{ secrets.SEMANTIC_SCHOLAR_API_KEY }}
run: |
pytest -m "integration" -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella