From 5c1c3c6de30c8fd01b5e06dbc4c1ca93b2aaaacc Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 17 Jan 2025 09:59:30 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0=E5=A2=9EPyright=20Lint?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pyright.yml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/pyright.yml diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml new file mode 100644 index 00000000..ac93614a --- /dev/null +++ b/.github/workflows/pyright.yml @@ -0,0 +1,72 @@ +name: Pyright Lint + +on: + push: + branches: + - "*" + pull_request: + paths: + - "zhenxun/**" + - "tests/**" + - ".github/workflows/pyright.yml" + - "pyproject.toml" + - "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: + pyright: + name: Pyright Lint + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + fail-fast: false + concurrency: + group: pyright-${{ github.ref }}-${{ matrix.python-version }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python - + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Cache Poetry packages + 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 + shell: bash + run: | + extra_args="${{ github.event.inputs.debug-mode == 'true' && '--warnings --verbose --level verbose' || '--warnings --verbose' }}" + poetry run pyright . $extra_args