Skip to content

docs: add Sphinx documentation tree with mapping reference and API do… #87

docs: add Sphinx documentation tree with mapping reference and API do…

docs: add Sphinx documentation tree with mapping reference and API do… #87

Workflow file for this run

name: CI - Test and Validate
on:
pull_request:
push:
branches:
- develop
- 'release/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docs-only:
name: docs-only
runs-on: ubuntu-latest
outputs:
docs_only: ${{ steps.detect.outputs.docs_only }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect docs-only changes
id: detect
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "docs_only=false" >> "$GITHUB_OUTPUT"
exit 0
fi
files=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
if [ -z "$files" ]; then
echo "docs_only=false" >> "$GITHUB_OUTPUT"
exit 0
fi
docs_only=true
for file in $files; do
if [[ "$file" == docs/* ]] || [[ "$file" == "README.md" ]] || [[ "$file" == "CHANGELOG.md" ]]; then
continue
fi
docs_only=false
break
done
echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT"
standards-compliance:
name: standards-compliance
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install markdownlint
run: npm install --global markdownlint-cli
- name: Fetch base branch for commit linting
if: github.event_name == 'pull_request'
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Validate repository profile
run: scripts/lint/repo-profile.sh
- name: Validate markdown standards
run: scripts/lint/markdown-standards.sh
- name: Validate commit messages
if: github.event_name == 'pull_request'
run: scripts/lint/commit-messages.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Validate pull request issue linkage
if: github.event_name == 'pull_request'
run: scripts/lint/pr-issue-linkage.sh
dependency-audit:
name: dependency-audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install uv
run: python3 -m pip install uv==0.9.26
- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-py3.14-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-py3.14-
- name: Install dependencies
run: uv sync --frozen --group dev
- name: Run pip-audit (fail on any vulnerability)
run: uv run pip-audit -r requirements.txt -r requirements-dev.txt
test-and-validate:
name: test-and-validate
runs-on: ubuntu-latest
needs: docs-only
strategy:
matrix:
python-version: ["3.14"]
steps:
- name: Docs-only short-circuit
if: needs.docs-only.outputs.docs_only == 'true'
run: echo "Docs-only changes detected; skipping test-and-validate."
- name: Checkout code
if: needs.docs-only.outputs.docs_only != 'true'
uses: actions/checkout@v4
- name: Fetch base branch for version checks
if: github.event_name == 'pull_request' && needs.docs-only.outputs.docs_only != 'true'
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Set up Python ${{ matrix.python-version }}
if: needs.docs-only.outputs.docs_only != 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Validate version string policy
if: needs.docs-only.outputs.docs_only != 'true'
run: python3 scripts/dev/validate_version.py
- name: Install uv
if: needs.docs-only.outputs.docs_only != 'true'
run: python3 -m pip install uv==0.9.26
- name: Validate dependency specifications
if: needs.docs-only.outputs.docs_only != 'true'
run: python3 scripts/dev/validate_dependency_specs.py
- name: Verify uv.lock sync
if: needs.docs-only.outputs.docs_only != 'true'
run: uv lock --check
- name: Cache uv
if: needs.docs-only.outputs.docs_only != 'true'
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-py${{ matrix.python-version }}-
- name: Install dependencies
if: needs.docs-only.outputs.docs_only != 'true'
run: uv sync --frozen --group dev
- name: Run ruff check
if: needs.docs-only.outputs.docs_only != 'true'
run: uv run ruff check
- name: Run ruff format check
if: needs.docs-only.outputs.docs_only != 'true'
run: uv run ruff format --check .
- name: Run mypy
if: needs.docs-only.outputs.docs_only != 'true'
run: uv run mypy src/
- name: Run ty
if: needs.docs-only.outputs.docs_only != 'true'
run: uv run ty check src
- name: Run tests with coverage
if: needs.docs-only.outputs.docs_only != 'true'
run: |
uv run pytest \
--cov=pymqrest \
--cov-report=term-missing \
--cov-branch \
--cov-fail-under=100