name: CI
on:
push:
branches: [main, hotfix/**, release/**, jules/**, copilot/**]
pull_request:
branches: [main]
# Prevent duplicate parallel runs for same branch/PR; keep latest
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
python-version: ["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 uv
uses: astral-sh/setup-uv@v3
- name: Sync dependencies (dev + extras)
run: |
uv sync --all-extras --dev
- name: Lint
run: |
uv run black --check stac_mcp/ tests/ examples/
uv run ruff check stac_mcp/ tests/ examples/
- name: Build (hatchling via uv) to validate packaging
run: |
uv build
- name: Tests + coverage
run: |
uv run coverage run -m pytest -q
uv run coverage xml
uv run python scripts/generate_coverage_badge.py coverage.xml coverage-badge.svg
uv run coverage report
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-artifacts-${{ matrix.python-version }}
path: |
coverage.xml
coverage-badge.svg
- name: Commit badge (main only)
if: github.ref == 'refs/heads/main' && matrix.python-version == '3.12'
run: |
if git diff --quiet coverage-badge.svg 2>/dev/null; then
echo 'No badge changes'
else
git config user.name 'github-actions'
git config user.email 'actions@github.com'
git add coverage-badge.svg
git commit -m 'chore(ci): update coverage badge'
git push
fi
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["python"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install dependencies (runtime only)
run: |
uv sync
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3