mirror of https://github.com/tiangolo/fastapi.git
👷 Use uv in CI (#12281)
This commit is contained in:
parent
3347f0dde5
commit
a30eb6f517
|
|
@ -7,6 +7,10 @@ on:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -48,18 +52,20 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- uses: actions/cache@v4
|
- name: Setup uv
|
||||||
id: cache
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
version: "0.4.15"
|
||||||
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-insiders.txt', 'requirements-docs-tests.txt') }}-v08
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
- name: Install docs extras
|
- name: Install docs extras
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: uv pip install -r requirements-docs.txt
|
||||||
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
|
# Install MkDocs Material Insiders here just to put it in the cache for the rest of the steps
|
||||||
- name: Install Material for MkDocs Insiders
|
- name: Install Material for MkDocs Insiders
|
||||||
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
|
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
|
||||||
run: pip install -r requirements-docs-insiders.txt
|
run: uv pip install -r requirements-docs-insiders.txt
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}
|
TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}
|
||||||
- name: Verify Docs
|
- name: Verify Docs
|
||||||
|
|
@ -88,17 +94,19 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- uses: actions/cache@v4
|
- name: Setup uv
|
||||||
id: cache
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
version: "0.4.15"
|
||||||
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-insiders.txt', 'requirements-docs-tests.txt') }}-v08
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
- name: Install docs extras
|
- name: Install docs extras
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: uv pip install -r requirements-docs.txt
|
||||||
run: pip install -r requirements-docs.txt
|
|
||||||
- name: Install Material for MkDocs Insiders
|
- name: Install Material for MkDocs Insiders
|
||||||
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
|
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
|
||||||
run: pip install -r requirements-docs-insiders.txt
|
run: uv pip install -r requirements-docs-insiders.txt
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}
|
TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}
|
||||||
- name: Update Languages
|
- name: Update Languages
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
statuses: write
|
statuses: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-docs:
|
deploy-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -25,21 +28,22 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- uses: actions/cache@v4
|
- name: Setup uv
|
||||||
id: cache
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
version: "0.4.15"
|
||||||
key: ${{ runner.os }}-python-github-actions-${{ env.pythonLocation }}-${{ hashFiles('requirements-github-actions.txt') }}-v01
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
- name: Install GitHub Actions dependencies
|
- name: Install GitHub Actions dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: uv pip install -r requirements-github-actions.txt
|
||||||
run: pip install -r requirements-github-actions.txt
|
|
||||||
- name: Deploy Docs Status Pending
|
- name: Deploy Docs Status Pending
|
||||||
run: python ./scripts/deploy_docs_status.py
|
run: python ./scripts/deploy_docs_status.py
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||||
RUN_ID: ${{ github.run_id }}
|
RUN_ID: ${{ github.run_id }}
|
||||||
|
|
||||||
- name: Clean site
|
- name: Clean site
|
||||||
run: |
|
run: |
|
||||||
rm -rf ./site
|
rm -rf ./site
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ on:
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
label-approved:
|
label-approved:
|
||||||
if: github.repository_owner == 'fastapi'
|
if: github.repository_owner == 'fastapi'
|
||||||
|
|
@ -19,8 +22,22 @@ jobs:
|
||||||
run: echo "$GITHUB_CONTEXT"
|
run: echo "$GITHUB_CONTEXT"
|
||||||
- uses: docker://tiangolo/label-approved:0.0.4
|
- uses: docker://tiangolo/label-approved:0.0.4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
python-version: "3.11"
|
||||||
config: >
|
- name: Setup uv
|
||||||
|
uses: astral-sh/setup-uv@v3
|
||||||
|
with:
|
||||||
|
version: "0.4.15"
|
||||||
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
|
- name: Install GitHub Actions dependencies
|
||||||
|
run: uv pip install -r requirements-github-actions.txt
|
||||||
|
- name: Label Approved
|
||||||
|
run: python ./scripts/label_approved.py
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CONFIG: >
|
||||||
{
|
{
|
||||||
"approved-1":
|
"approved-1":
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ on:
|
||||||
permissions:
|
permissions:
|
||||||
discussions: write
|
discussions: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
notify-translations:
|
notify-translations:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -27,6 +30,19 @@ jobs:
|
||||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||||
run: echo "$GITHUB_CONTEXT"
|
run: echo "$GITHUB_CONTEXT"
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
- name: Setup uv
|
||||||
|
uses: astral-sh/setup-uv@v3
|
||||||
|
with:
|
||||||
|
version: "0.4.15"
|
||||||
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
# Allow debugging with tmate
|
# Allow debugging with tmate
|
||||||
- name: Setup tmate session
|
- name: Setup tmate session
|
||||||
uses: mxschmitt/action-tmate@v3
|
uses: mxschmitt/action-tmate@v3
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ on:
|
||||||
permissions:
|
permissions:
|
||||||
statuses: write
|
statuses: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
smokeshow:
|
smokeshow:
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
|
@ -21,16 +24,21 @@ jobs:
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
|
- name: Setup uv
|
||||||
- run: pip install smokeshow
|
uses: astral-sh/setup-uv@v3
|
||||||
|
with:
|
||||||
|
version: "0.4.15"
|
||||||
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
|
- run: uv pip install -r requirements-github-actions.txt
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: coverage-html
|
name: coverage-html
|
||||||
path: htmlcov
|
path: htmlcov
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
- run: smokeshow upload htmlcov
|
- run: smokeshow upload htmlcov
|
||||||
env:
|
env:
|
||||||
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
|
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ on:
|
||||||
# cron every week on monday
|
# cron every week on monday
|
||||||
- cron: "0 0 * * 1"
|
- cron: "0 0 * * 1"
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_SYSTEM_PYTHON: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -25,19 +28,18 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
# Issue ref: https://github.com/actions/setup-python/issues/436
|
- name: Setup uv
|
||||||
# cache: "pip"
|
uses: astral-sh/setup-uv@v3
|
||||||
# cache-dependency-path: pyproject.toml
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
id: cache
|
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
version: "0.4.15"
|
||||||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-pydantic-v2-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: uv pip install -r requirements-tests.txt
|
||||||
run: pip install -r requirements-tests.txt
|
|
||||||
- name: Install Pydantic v2
|
- name: Install Pydantic v2
|
||||||
run: pip install --upgrade "pydantic>=2.0.2,<3.0.0"
|
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0"
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: bash scripts/lint.sh
|
run: bash scripts/lint.sh
|
||||||
|
|
||||||
|
|
@ -63,23 +65,22 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
# Issue ref: https://github.com/actions/setup-python/issues/436
|
- name: Setup uv
|
||||||
# cache: "pip"
|
uses: astral-sh/setup-uv@v3
|
||||||
# cache-dependency-path: pyproject.toml
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
id: cache
|
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
version: "0.4.15"
|
||||||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ matrix.pydantic-version }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: uv pip install -r requirements-tests.txt
|
||||||
run: pip install -r requirements-tests.txt
|
|
||||||
- name: Install Pydantic v1
|
- name: Install Pydantic v1
|
||||||
if: matrix.pydantic-version == 'pydantic-v1'
|
if: matrix.pydantic-version == 'pydantic-v1'
|
||||||
run: pip install "pydantic>=1.10.0,<2.0.0"
|
run: uv pip install "pydantic>=1.10.0,<2.0.0"
|
||||||
- name: Install Pydantic v2
|
- name: Install Pydantic v2
|
||||||
if: matrix.pydantic-version == 'pydantic-v2'
|
if: matrix.pydantic-version == 'pydantic-v2'
|
||||||
run: pip install --upgrade "pydantic>=2.0.2,<3.0.0"
|
run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0"
|
||||||
- run: mkdir coverage
|
- run: mkdir coverage
|
||||||
- name: Test
|
- name: Test
|
||||||
run: bash scripts/test.sh
|
run: bash scripts/test.sh
|
||||||
|
|
@ -105,16 +106,22 @@ jobs:
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.8'
|
python-version: '3.8'
|
||||||
# Issue ref: https://github.com/actions/setup-python/issues/436
|
- name: Setup uv
|
||||||
# cache: "pip"
|
uses: astral-sh/setup-uv@v3
|
||||||
# cache-dependency-path: pyproject.toml
|
with:
|
||||||
|
version: "0.4.15"
|
||||||
|
enable-cache: true
|
||||||
|
cache-dependency-glob: |
|
||||||
|
requirements**.txt
|
||||||
|
pyproject.toml
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: uv pip install -r requirements-tests.txt
|
||||||
- name: Get coverage files
|
- name: Get coverage files
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
pattern: coverage-*
|
pattern: coverage-*
|
||||||
path: coverage
|
path: coverage
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- run: pip install coverage[toml]
|
|
||||||
- run: ls -la coverage
|
- run: ls -la coverage
|
||||||
- run: coverage combine coverage
|
- run: coverage combine coverage
|
||||||
- run: coverage report
|
- run: coverage report
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ PyGithub>=2.3.0,<3.0.0
|
||||||
pydantic>=2.5.3,<3.0.0
|
pydantic>=2.5.3,<3.0.0
|
||||||
pydantic-settings>=2.1.0,<3.0.0
|
pydantic-settings>=2.1.0,<3.0.0
|
||||||
httpx>=0.27.0,<0.28.0
|
httpx>=0.27.0,<0.28.0
|
||||||
|
smokeshow
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue