Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Coverage

on:
push:
branches: [main]
workflow_dispatch:

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: pyproject.toml

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b

- name: Install the project
run: uv sync --frozen

- name: Coverage
run: uv run --no-sync pytest --cov-report=xml --cov-report=term

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
format: cobertura
file: coverage.xml
44 changes: 44 additions & 0 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy documentation to Pages

on:
release:
types:
- published
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b

- name: Build site
run: uv run --frozen --group docs mkdocs build

- name: Setup Pages
uses: actions/configure-pages@v6

- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: ./site

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
42 changes: 42 additions & 0 deletions .github/workflows/deploy-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy to PyPI

on:
release:
types:
- published

jobs:
build:
name: Build python packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Build
run: pipx run build

- uses: actions/upload-artifact@v7
with:
path: dist/*

publish:
name: Publish to PyPI
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/fastapi-caching-route
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
85 changes: 85 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: PR Checks

on:
pull_request:
branches:
- main

jobs:
pytest:
name: Tests Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t']
steps:
- name: Checkout
uses: actions/checkout@v7

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b

- name: Install the project
run: uv sync --frozen

- name: Run pytest
run: uv run --no-sync pytest --no-cov

code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: pyproject.toml

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b

- name: Check uv.lock
run: uv lock --check

- name: Install the project
run: uv sync --frozen

- name: Ruff check
id: ruff-check
continue-on-error: true
run: uv run --no-sync ruff check --output-format=github

- name: Ruff format
id: ruff-format
continue-on-error: true
run: uv run --no-sync ruff format --check --output-format=github

- name: Type check
id: ty
continue-on-error: true
run: uv run --no-sync ty check --output-format=github

- name: Fail if any step failed
if: |
steps.ruff-check.outcome == 'failure' ||
steps.ruff-format.outcome == 'failure' ||
steps.ty.outcome == 'failure'
run: exit 1

summary:
name: PR Checks Summary
runs-on: ubuntu-latest
if: always()
needs: [pytest, code-quality]
steps:
- run: >
test
"${{ needs.pytest.result }}" = "success" -a
"${{ needs.code-quality.result }}" = "success"
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@ dependencies = [
[dependency-groups]
dev = [
"fastapi~=0.138",
"griffe-typingdoc~=0.3",
"httpx2~=2.5",
"markdown-include~=0.8",
"mkdocs-material~=9.7",
"mkdocstrings[python]~=1.0",
"mkdocs~=1.6",
"pytest-cov~=7.1",
"pytest~=9.1",
"ruff~=0.15",
"ty>=0.0.56",
"uvicorn[standard]~=0.49",
]
docs = [
"griffe-typingdoc~=0.3",
"markdown-include~=0.8",
"mkdocs-material~=9.7",
"mkdocstrings[python]~=1.0",
"mkdocs~=1.6",
]

[project.urls]
Homepage = "https://github.com/mentaljam/fastapi-caching-route"
Expand Down
24 changes: 14 additions & 10 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading