Skip to content

CI

CI #577

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Nightly at 03:00 UTC
- cron: "0 3 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install dependencies
run: uv sync --frozen --extra dev --extra cli --extra mcp --extra route53 --extra otel
- name: Run unit tests
run: uv run pytest tests/unit/ -v --tb=short
- name: Run tests with coverage
run: uv run pytest tests/unit/ --cov=dns_aid --cov-report=xml --cov-report=term-missing
- name: Upload coverage artifact
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-report
path: coverage.xml
- name: Generate coverage badge
if: matrix.python-version == '3.12' && github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
with:
filename: coverage.xml
badge: true
format: markdown
output: both
- name: Upload coverage badge
if: matrix.python-version == '3.12' && github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-badge
path: code-coverage-results.md
integration:
name: Mock Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install dependencies
run: uv sync --frozen --extra dev --extra cli --extra mcp --extra route53 --extra otel
- name: Run mock integration tests
run: uv run pytest tests/integration/ -m "not live" -v --tb=short
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install dependencies
run: uv sync --frozen --extra dev
- name: Ruff check
run: uv run ruff check src/
- name: Ruff format check
run: uv run ruff format --check src/
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install dependencies
run: uv sync --frozen --extra dev --extra cli --extra mcp --extra route53 --extra otel
- name: Mypy
run: uv run mypy src/dns_aid
readme-mcp-name:
name: README mcp-name tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Verify README carries the MCP Registry mcp-name tag
run: |
# The MCP Registry validates package ownership against this tag in
# the PUBLISHED PyPI README. Dropping it silently breaks the release
# MCP Registry publish (it regressed in 0.24.0, fixed in 0.24.1).
# Fail loudly here so no PR can drop it again unnoticed.
if ! grep -qF 'mcp-name: io.github.dns-aid/dns-aid' README.md; then
echo "::error file=README.md::README is missing the required MCP Registry ownership tag '<!-- mcp-name: io.github.dns-aid/dns-aid -->' — the release MCP Registry publish will fail without it."
exit 1
fi
echo "OK: README carries the mcp-name tag."