109 lines
3.5 KiB
YAML
109 lines
3.5 KiB
YAML
name: Shared Checks
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
COLUMNS: 150
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
with:
|
|
enable-cache: true
|
|
version: 0.9.5
|
|
- name: Install dependencies
|
|
run: uv sync --frozen --all-extras --python 3.10
|
|
|
|
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|
|
with:
|
|
extra_args: --all-files --verbose
|
|
env:
|
|
SKIP: no-commit-to-branch,readme-v1-frozen
|
|
|
|
- name: Surface types match vendored schema
|
|
run: |
|
|
uv sync --group codegen --frozen
|
|
uv run --frozen --group codegen python scripts/gen_surface_types.py --check
|
|
|
|
# TODO(Max): Drop this in v2. Deliberate updates (e.g. the v2 status
|
|
# banner) go through the 'override-readme-freeze' label.
|
|
- name: Check README.md is not modified
|
|
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'override-readme-freeze')
|
|
run: |
|
|
git fetch --no-tags --depth=1 origin "$BASE_SHA"
|
|
if git diff --name-only "$BASE_SHA" -- README.md | grep -q .; then
|
|
echo "::error::README.md is frozen at v1. Edit README.v2.md instead."
|
|
exit 1
|
|
fi
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
|
|
test:
|
|
name: test (${{ matrix.python-version }}, ${{ matrix.dep-resolution.name }}, ${{ matrix.os }})
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 10
|
|
continue-on-error: true
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
dep-resolution:
|
|
- name: lowest-direct
|
|
install-flags: "--upgrade --resolution lowest-direct"
|
|
- name: locked
|
|
install-flags: "--frozen"
|
|
os: [ubuntu-latest, windows-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
with:
|
|
enable-cache: true
|
|
version: 0.9.5
|
|
|
|
- name: Install the project
|
|
run: uv sync ${{ matrix.dep-resolution.install-flags }} --all-extras --python ${{ matrix.python-version }}
|
|
|
|
- name: Run pytest with coverage
|
|
shell: bash
|
|
run: |
|
|
uv run --frozen --no-sync coverage erase
|
|
uv run --frozen --no-sync coverage run -m pytest -n auto
|
|
uv run --frozen --no-sync coverage combine
|
|
uv run --frozen --no-sync coverage report
|
|
|
|
- name: Check for unnecessary no cover pragmas
|
|
if: runner.os != 'Windows'
|
|
run: uv run --frozen --no-sync strict-no-cover
|
|
|
|
readme-snippets:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
with:
|
|
enable-cache: true
|
|
version: 0.9.5
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --frozen --all-extras --python 3.10
|
|
|
|
- name: Check README snippets are up to date
|
|
run: uv run --frozen scripts/update_readme_snippets.py --check --readme README.v2.md
|