name: MR Checks
on: [ pull_request ]
jobs:
python-check:
strategy:
max-parallel: 3
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
# 缓存 Poetry 依赖
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-
# 缓存 nox 环境
- name: Cache nox environments
uses: actions/cache@v4
with:
path: .nox
key: ${{ runner.os }}-nox-${{ matrix.python-version }}-${{ hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-nox-${{ matrix.python-version }}-
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install uv
uv --version
- name: Install dependencies
run: |
uvx poetry install
- name: Lint
run: |
uvx nox -s lint
- name: Test
run: |
uvx nox -s pytest