mirror of
https://github.com/fastapi/fastapi.git
synced 2026-03-02 13:48:52 -05:00
* ➕ Add mkdocstrings and griffe-typingdoc to dependencies * 🔧 Add mkdocstrings configs to MkDocs * 📝 Add first WIP reference page * ⬆️ Upgrade typing-extensions to the minimum version including Doc() * 📝 Add docs to FastAPI parameters * 📝 Add docstrings for OpenAPI docs utils * 📝 Add docstrings for security utils * 📝 Add docstrings for UploadFile * 📝 Update docstrings in FastAPI class * 📝 Add docstrings for path operation methods * 📝 Add docstring for jsonable_encoder * 📝 Add docstrings for exceptions * 📝 Add docstsrings for parameter functions * 📝 Add docstrings for responses * 📝 Add docstrings for APIRouter * ♻️ Sub-class BackgroundTasks to document it with docstrings * 📝 Update usage of background tasks in dependencies * ✅ Update tests with new deprecation warnings * 📝 Add new reference docs * 🔧 Update MkDocs with new reference docs * ✅ Update pytest fixture, deprecation is raised only once * 🎨 Update format for types in exceptions.py * ♻️ Update annotations in BackgroundTask, `Annotated` can't take ParamSpec's P.args or P.kwargs * ✏️ Fix typos caught by @pawamoy * 🔧 Update and fix MkDocstrings configs from @pawamoy tips * 📝 Update reference docs * ✏️ Fix typos found by @pawamoy * ➕ Add HTTPX as a dependency for docs, for the TestClient * 🔧 Update MkDocs config, rename websockets reference * 🔇 Add type-ignores for Doc as the stubs haven't been released for mypy * 🔥 Remove duplicated deprecated notice * 🔇 Remove typing error for unreleased stub in openapi/docs.py * ✅ Add tests for UploadFile for coverage * ⬆️ Upgrade griffe-typingdoc==0.2.2 * 📝 Refactor docs structure * 🔨 Update README generation with new index frontmatter and style * 🔨 Update generation of languages, remove from top menu, keep in lang menu * 📝 Add OpenAPI Pydantic models * 🔨 Update docs script to not translate Reference and Release Notes * 🔧 Add reference for OpenAPI models * 🔧 Update MkDocs config for mkdocstrings insiders * 👷 Install mkdocstring insiders in CI for docs * 🐛 Fix MkDocstrings insiders install URL * ➕ Move dependencies shared by docs and tests to its own requirements file * 👷 Update cache keys for test and docs dependencies * 📝 Remove no longer needed __init__ placeholder docstrings * 📝 Move docstring for APIRouter to the class level (not __init__ level) * 🔥 Remove no longer needed dummy placeholder __init__ docstring
121 lines
4.5 KiB
YAML
121 lines
4.5 KiB
YAML
name: Build Docs
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
# Required permissions
|
|
permissions:
|
|
pull-requests: read
|
|
# Set job outputs to values from filter step
|
|
outputs:
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# For pull requests it's not necessary to checkout the code but for master it is
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
docs:
|
|
- README.md
|
|
- docs/**
|
|
- docs_src/**
|
|
- requirements-docs.txt
|
|
langs:
|
|
needs:
|
|
- changes
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
langs: ${{ steps.show-langs.outputs.langs }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
- uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: ${{ env.pythonLocation }}
|
|
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-tests.txt') }}-v06
|
|
- name: Install docs extras
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: pip install -r requirements-docs.txt
|
|
# Install MkDocs Material Insiders here just to put it in the cache for the rest of the steps
|
|
- name: Install Material for MkDocs Insiders
|
|
if: ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
pip install git+https://${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
|
|
pip install git+https://${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/griffe-typing-deprecated.git
|
|
pip install git+https://${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/mkdocstrings-python.git
|
|
- name: Export Language Codes
|
|
id: show-langs
|
|
run: |
|
|
echo "langs=$(python ./scripts/docs.py langs-json)" >> $GITHUB_OUTPUT
|
|
|
|
build-docs:
|
|
needs:
|
|
- changes
|
|
- langs
|
|
if: ${{ needs.changes.outputs.docs == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
lang: ${{ fromJson(needs.langs.outputs.langs) }}
|
|
steps:
|
|
- name: Dump GitHub context
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
run: echo "$GITHUB_CONTEXT"
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
- uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: ${{ env.pythonLocation }}
|
|
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-tests.txt') }}-v06
|
|
- name: Install docs extras
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: pip install -r requirements-docs.txt
|
|
- name: Install Material for MkDocs Insiders
|
|
if: ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
pip install git+https://${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
|
|
pip install git+https://${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/griffe-typing-deprecated.git
|
|
pip install git+https://${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/mkdocstrings-python.git
|
|
- name: Update Languages
|
|
run: python ./scripts/docs.py update-languages
|
|
- uses: actions/cache@v3
|
|
with:
|
|
key: mkdocs-cards-${{ matrix.lang }}-${{ github.ref }}
|
|
path: docs/${{ matrix.lang }}/.cache
|
|
- name: Build Docs
|
|
run: python ./scripts/docs.py build-lang ${{ matrix.lang }}
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: docs-site
|
|
path: ./site/**
|
|
|
|
# https://github.com/marketplace/actions/alls-green#why
|
|
docs-all-green: # This job does nothing and is only used for the branch protection
|
|
if: always()
|
|
needs:
|
|
- build-docs
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Decide whether the needed jobs succeeded or failed
|
|
uses: re-actors/alls-green@release/v1
|
|
with:
|
|
jobs: ${{ toJSON(needs) }}
|
|
allowed-skips: build-docs
|