Files
2026-07-13 13:39:38 +08:00

79 lines
2.3 KiB
YAML

name: CI
on:
push:
branches: [main, 0.x]
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
workflow_dispatch:
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.10"
- name: Install the project
run: uv sync --all-extras --dev
- name: Ruff
run: uv run ruff check --output-format=github .
continue-on-error: true
id: ruff-check
- name: Check format
run: uv run ruff format --check .
continue-on-error: true
id: ruff-format
- name: Report ruff errors
if: steps.ruff-check.outcome == 'failure' || steps.ruff-format.outcome == 'failure'
run: |
echo "::error::Ruff checks failed. Please run 'make fix' locally to automatically fix formatting and linting issues."
exit 1
type-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras --dev
- name: Cache mypy
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .mypy_cache
key: mypy-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}-${{ github.run_id }}
restore-keys: |
mypy-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}-
mypy-${{ matrix.python-version }}-
- name: Check Types
run: uv run python scripts/check_types.py