name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Run linting
run: |
uv run ruff check .
uv run ruff format --check .
continue-on-error: true
- name: Run unit tests (fast)
run: uv run pytest test/ -v --tb=short --color=yes -m "not slow and not integration and not judge"
- name: Run integration tests
run: uv run pytest test/ -v --tb=short --color=yes -m "integration and not slow and not judge"
continue-on-error: true
- name: Run slow tests
run: uv run pytest test/ -v --tb=short --color=yes -m "slow and not judge"
continue-on-error: true
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
- name: Run all tests with coverage (excluding judge tests)
run: |
uv add --dev pytest-cov
uv run pytest test/ --cov=src/gget_mcp --cov-report=xml --cov-report=term-missing -m "not judge"
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
test-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Test server startup (stdio mode)
run: |
timeout 10s uv run stdio || [ $? -eq 124 ]
- name: Test server startup (http mode)
run: |
uv run server --port 8000 &
SERVER_PID=$!
sleep 5
curl -f http://localhost:8000/health || curl -f http://localhost:8000/ || echo "Server health check failed"
kill $SERVER_PID || true
- name: Test server startup (sse mode)
run: |
uv run sse --port 8001 &
SERVER_PID=$!
sleep 5
curl -f http://localhost:8001/health || curl -f http://localhost:8001/ || echo "SSE server health check failed"
kill $SERVER_PID || true
- name: Test MCP configuration
run: |
# Test that MCP config files are valid JSON if they exist
if [ -f mcp-config.json ]; then
python -m json.tool mcp-config.json > /dev/null
fi
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Run security checks
run: |
uv add --dev bandit safety
uv run bandit -r src/ -f json || true
uv run safety check || true