mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-19 20:14:17 +02:00
88 lines
2.6 KiB
YAML
88 lines
2.6 KiB
YAML
name: Run static analysis
|
|
|
|
env:
|
|
# enable colored output
|
|
# https://github.com/pytest-dev/pytest/issues/7443
|
|
PY_COLORS: 1
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- "src/**"
|
|
- "tests/**"
|
|
- "uv.lock"
|
|
- "pyproject.toml"
|
|
- ".github/workflows/**"
|
|
|
|
# run on all pull requests because these checks are required and will block merges otherwise
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
static_analysis:
|
|
timeout-minutes: 2
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: "uv.lock"
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install dependencies
|
|
run: uv sync --dev
|
|
- name: Install just
|
|
uses: extractions/setup-just@v3
|
|
- name: Check lockfile is up to date
|
|
run: |
|
|
if ! uv lock --check; then
|
|
echo "❌ Lockfile is out of date!"
|
|
echo "To update the lockfile, run 'uv lock'."
|
|
exit 1
|
|
fi
|
|
echo "✅ Lockfile is up to date"
|
|
- name: Run pre-commit
|
|
uses: pre-commit/action@v3.0.1
|
|
env:
|
|
SKIP: no-commit-to-branch
|
|
- name: Check SDK documentation is up to date
|
|
run: |
|
|
# Save original docs.json for comparison
|
|
cp docs/docs.json docs/docs.json.orig
|
|
|
|
# Generate documentation
|
|
just api-ref-all > /dev/null 2>&1
|
|
|
|
# Check if python-sdk files changed
|
|
if ! git diff --quiet docs/python-sdk/; then
|
|
echo "❌ SDK documentation is out of date!"
|
|
echo "Files that were updated:"
|
|
git diff --name-only docs/python-sdk/
|
|
echo ""
|
|
echo "Run `just api-ref-all` to regenerate the SDK docs, then commit the changes. Note: you may need to install `just` (https://github.com/casey/just)"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if docs.json content changed (ignoring formatting)
|
|
if ! jq --sort-keys . docs/docs.json.orig | diff -q - <(jq --sort-keys . docs/docs.json) > /dev/null 2>&1; then
|
|
echo "❌ docs.json content has changed!"
|
|
echo ""
|
|
echo "Run `just api-ref-all` to regenerate the SDK docs, then commit the changes. Note: you may need to install `just` (https://github.com/casey/just)"
|
|
exit 1
|
|
fi
|
|
|
|
# Restore original docs.json to avoid false positives
|
|
mv docs/docs.json.orig docs/docs.json
|
|
|
|
echo "✅ SDK documentation is up to date"
|