Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a6d35b9
Optimize cache for `pre-commit` workflow
YuriiMotov Aug 6, 2026
546c1d0
Optimize cache for `test` workflow
YuriiMotov Aug 6, 2026
64a1499
Optimize cache for `build-docs` and `deploy-docs` workflows
YuriiMotov Aug 6, 2026
5d9a14e
Optimize cache for 3 workflows by reading `dev-all` cache
YuriiMotov Aug 6, 2026
938d2e6
Optimize cache for GH-actions-related workflows
YuriiMotov Aug 6, 2026
ae8a2a7
Add `UV_NO_SYNC: true` in `publish` workflow
YuriiMotov Aug 6, 2026
8806a3b
Bump uv version in workflows
YuriiMotov Aug 6, 2026
fbaaa00
Fix possible cache collision for highest and lowest uv resolutions
YuriiMotov Aug 6, 2026
ac671da
Add `.python-version` to `build-docs` workflow's filters
YuriiMotov Aug 6, 2026
e7b7077
Merge branch 'master' into optimize-workflow-cache
YuriiMotov Aug 7, 2026
472429b
Add path filters and if `org=fastapi` for `warm-cache` workflow
YuriiMotov Aug 7, 2026
79c30a9
Allow `pre-commit` save cache
YuriiMotov Aug 7, 2026
9144490
Specify `--group dev` explicitly in `warm-cache.yml`
YuriiMotov Aug 7, 2026
10375c0
Merge remote-tracking branch 'upstream/master' into optimize-workflow…
YuriiMotov Aug 10, 2026
fcfe882
Merge remote-tracking branch 'upstream/master' into optimize-workflow…
YuriiMotov Aug 26, 2026
e803afc
Revert "Add `.python-version` to `build-docs` workflow's filters"
YuriiMotov Aug 26, 2026
4ebedc9
👷 Give `translate` workflow its own uv cache suffix
YuriiMotov Aug 26, 2026
da3bf33
Bump `astral-sh/setup-uv` to 10.0.1 in `warm-cache`
YuriiMotov Aug 26, 2026
ff6a7c0
Merge remote-tracking branch 'upstream/master' into optimize-workflow…
YuriiMotov Aug 26, 2026
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
5 changes: 5 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
permissions: {}

env:
UV_NO_SYNC: true

jobs:
changes:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,6 +58,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: docs
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down Expand Up @@ -92,6 +96,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: docs
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/bump-pre-commit-hooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
bump-pre-commit-hooks:
if: github.repository_owner == 'fastapi'
Expand Down Expand Up @@ -34,6 +37,11 @@ jobs:
cache-dependency-glob: |
pyproject.toml
uv.lock
cache-suffix: dev-all
# Disable saving cache as we install narrower set of dependencies than dev-all has.
save-cache: false
- name: Install dependencies
run: uv sync --locked --group dev
- name: Bump pre-commit hooks
run: uv run prek auto-update --freeze --cooldown-days 7
- name: Get PR Submit token
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/create-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
create-draft-release:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
Expand Down Expand Up @@ -34,6 +37,14 @@ jobs:
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
cache-dependency-glob: |
pyproject.toml
uv.lock
cache-suffix: dev-all
# Disable saving cache as we install narrower set of dependencies than dev-all has.
save-cache: false
- name: Install dependencies
run: uv sync --locked --group dev
- name: Extract release details
id: release-details
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
deploy-docs:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/label-approved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
label-approved:
if: github.repository_owner == 'fastapi'
Expand All @@ -31,6 +34,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: github-actions
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/notify-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
job:
runs-on: ubuntu-latest
Expand All @@ -43,6 +46,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: github-actions
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ permissions: {}

env:
CAN_PUSH: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
UV_NO_SYNC: true

jobs:
pre-commit:
Expand Down Expand Up @@ -46,6 +47,7 @@ jobs:
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
cache-suffix: dev-all
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
prepare-release:
runs-on: ubuntu-latest
Expand All @@ -44,6 +47,14 @@ jobs:
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
cache-dependency-glob: |
pyproject.toml
uv.lock
cache-suffix: dev-all
# Disable saving cache as we install narrower set of dependencies than dev-all has.
save-cache: false
- name: Install dependencies
run: uv sync --locked --group dev
- name: Prepare release
env:
PREPARE_RELEASE_BUMP: ${{ inputs.bump }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
types:
- published

env:
UV_NO_SYNC: true

permissions: {}

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/smokeshow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
smokeshow:
runs-on: ubuntu-latest
Expand All @@ -29,6 +32,7 @@ jobs:
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
cache-suffix: github-actions
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sponsors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
job:
if: github.repository_owner == 'fastapi'
Expand All @@ -37,6 +40,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: github-actions
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: tests-${{ matrix.uv-resolution }}
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down Expand Up @@ -181,6 +182,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: tests-highest
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down Expand Up @@ -249,6 +251,13 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: tests-highest
# This job checks out into `base/`, so the glob must point there.
cache-dependency-glob: |
base/pyproject.toml
base/uv.lock
# Only ever runs on pull requests, so anything it saved would be PR-scoped and useless.
save-cache: false
- name: Run the changed tests against the base code
if: steps.changed-tests.outputs.found == 'true'
working-directory: base
Expand Down Expand Up @@ -288,6 +297,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: tests-highest
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/topic-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
topic-repos:
if: github.repository_owner == 'fastapi'
Expand All @@ -32,6 +35,7 @@ jobs:
with:
version: "latest-known"
enable-cache: true
cache-suffix: github-actions
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/translate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ on:

permissions: {}

env:
UV_NO_SYNC: true

jobs:
langs:
runs-on: ubuntu-latest
Expand All @@ -56,6 +59,7 @@ jobs:
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
cache-suffix: translations
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down Expand Up @@ -98,6 +102,7 @@ jobs:
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
cache-suffix: translations
cache-dependency-glob: |
pyproject.toml
uv.lock
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/warm-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Warm Cache

# Populates the `dev-all` uv cache at default-branch scope so that it could be used by
# `pre-commit.yml` (it has `pull_request` trigger and can't write cache available across PRs)
# and some others that use subset of dev dependencies.

on:
push:
branches:
- master
paths:
- pyproject.toml
- uv.lock
- .python-version
- .github/workflows/warm-cache.yml
schedule:
- cron: "0 4 * * *"
workflow_dispatch:

permissions: {}

jobs:
warm-cache:
if: github.repository_owner == 'fastapi'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: ".python-version"
- name: Setup uv
id: setup-uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "latest-known"
enable-cache: true
cache-suffix: dev-all
cache-dependency-glob: |
pyproject.toml
uv.lock
- name: Populate the cache
if: steps.setup-uv.outputs.cache-hit != 'true'
run: uv sync --locked --group dev --extra all
Loading