name: Tests
on:
pull_request:
branches: [ main, master ]
push:
branches: [ main, master ]
workflow_dispatch:
jobs:
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout code
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 -e ".[dev]"
- name: Run linters
run: |
echo "Running Black..."
black --check src/ tests/
echo "Running Ruff..."
ruff check src/ tests/
echo "Running MyPy..."
mypy src/
- name: Run tests with pytest
run: |
pytest tests/ -v --tb=short -m "not integration"
test-docker:
name: Test Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t azure-pricing-mcp:test .
- name: Test Docker container health
run: |
# Start container in background
docker run -d --name test-container -p 8080:8080 azure-pricing-mcp:test
# Wait for container to be healthy
timeout 30s bash -c 'until docker inspect --format="{{.State.Health.Status}}" test-container | grep -q "healthy"; do sleep 2; done'
# Stop and remove container
docker stop test-container
docker rm test-container