name: CI
on:
push:
branches: [ main, develop, "claude/**" ]
pull_request:
branches: [ main, develop ]
jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort ruff mypy
pip install -r requirements.txt
- name: Check code formatting with black
run: black --check --diff .
- name: Check import sorting with isort
run: isort --check-only --diff .
- name: Lint with ruff
run: ruff check .
continue-on-error: true
- name: Type check with mypy
run: mypy app.py mcp_hub/ --ignore-missing-imports
continue-on-error: true
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['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 }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio
- name: Run tests with coverage
run: |
pytest --cov=app --cov=mcp_hub --cov-report=xml --cov-report=term-missing --cov-fail-under=50
env:
TAVILY_API_KEY: tvly-test-key-12345
NEBIUS_API_KEY: test-nebius-key
OPENAI_API_KEY: test-openai-key
ANTHROPIC_API_KEY: test-anthropic-key
HUGGINGFACE_API_KEY: test-hf-key
LLM_PROVIDER: nebius
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
continue-on-error: true
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install safety bandit
- name: Check dependencies for vulnerabilities
run: safety check --json || true
continue-on-error: true
- name: Run security linter
run: bandit -r app.py mcp_hub/ -f json || true
continue-on-error: true
build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: gradio-mcp-hub:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max