👷 测试提交

This commit is contained in:
HibiKier 2025-03-14 00:11:25 +08:00
parent fbbd002a50
commit 35f96bfb55
2 changed files with 56 additions and 42 deletions

40
.github/actions/setup-python/action.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Setup Python
description: Setup Python
inputs:
python-version:
description: Python version
required: false
default: "3.10"
env-dir:
description: Environment directory
required: false
default: "."
no-root:
description: Do not install package in the environment
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Install poetry
run: pipx install poetry
shell: bash
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "poetry"
cache-dependency-path: |
./poetry.lock
${{ inputs.env-dir }}/poetry.lock
- run: |
cd ${{ inputs.env-dir }}
if [ "${{ inputs.no-root }}" = "true" ]; then
poetry install --all-extras --no-root
else
poetry install --all-extras
fi
shell: bash

View File

@ -1,7 +1,6 @@
name: Pyright Lint name: Pyright Lint
on: on:
workflow_call: # 允许此工作流作为可重用工作流被调用
push: push:
branches: branches:
- "*" - "*"
@ -12,59 +11,34 @@ on:
- ".github/workflows/pyright.yml" - ".github/workflows/pyright.yml"
- "pyproject.toml" - "pyproject.toml"
- "poetry.lock" - "poetry.lock"
workflow_dispatch:
inputs:
python-version:
description: "Python version"
required: false
type: choice
options:
- "all"
- "3.10"
- "3.11"
- "3.12"
default: "all"
debug-mode:
description: "enable debug mode"
required: false
type: boolean
default: false
jobs: jobs:
pyright: pyright:
name: Pyright Lint name: Pyright Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency:
group: pyright-${{ github.ref }}-${{ matrix.env }}
cancel-in-progress: true
strategy: strategy:
matrix: matrix:
python-version: ["3.10", "3.11", "3.12"] env: [pydantic-v1, pydantic-v2]
fail-fast: false fail-fast: false
concurrency:
group: pyright-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4
- name: Setup Python - name: Setup Python environment
uses: actions/setup-python@v4 uses: ./.github/actions/setup-python
with: with:
python-version: ${{ matrix.python-version }} env-dir: ./envs/${{ matrix.env }}
no-root: true
- name: Install Poetry - run: |
run: | (cd ./envs/${{ matrix.env }} && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH)
curl -sSL https://install.python-poetry.org | python - if [ "${{ matrix.env }}" = "pydantic-v1" ]; then
echo "$HOME/.local/bin" >> $GITHUB_PATH sed -i 's/PYDANTIC_V2 = true/PYDANTIC_V2 = false/g' ./pyproject.toml
fi
- name: Cache Poetry packages shell: bash
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
run: poetry install
- name: Run Pyright - name: Run Pyright
uses: jakebailey/pyright-action@v2 uses: jakebailey/pyright-action@v2