Skip to content

Commit

Permalink
👷 CI: add pyright checking workflow (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Jan 24, 2025
1 parent c7154c6 commit 689cc1e
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 82 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Pyright Lint

on:
push:
branches:
- master
pull_request:
paths:
- "envs/**"
- "githubkit/**"
- "tests/**"
- "codegen/**"
- ".github/actions/setup-python/**"
- ".github/workflows/pyright.yml"
- "**/pyproject.toml"
- "**/poetry.lock"

jobs:
lint-githubkit:
name: GitHubKit Lint
runs-on: ubuntu-latest
concurrency:
group: pyright-${{ github.ref }}-${{ matrix.env }}
cancel-in-progress: true
strategy:
matrix:
env: [pydantic-v1, pydantic-v2]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Setup Python environment
uses: ./.github/actions/setup-python
with:
env-dir: ./envs/${{ matrix.env }}
no-root: true

- run: |
(cd ./envs/${{ matrix.env }} && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH)
if [ "${{ matrix.env }}" = "pydantic-v1" ]; then
sed -i 's/PYDANTIC_V2 = true/PYDANTIC_V2 = false/g' ./pyproject.toml
fi
shell: bash
- name: Run Pyright
uses: jakebailey/pyright-action@v2
with:
pylance-version: latest-release

lint-codegen:
name: Codegen Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Python environment
uses: ./.github/actions/setup-python
with:
env-dir: .

- run: |
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
shell: bash
- name: Run Pyright
uses: jakebailey/pyright-action@v2
with:
working-directory: ./codegen
pylance-version: latest-release
10 changes: 10 additions & 0 deletions codegen/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ target-version = "py310"

[tool.ruff.lint]
ignore = ["TID"]

[tool.pyright]
typeCheckingMode = "standard"
reportPrivateImportUsage = false
reportShadowedImports = false
disableBytesTypePromotions = true

pythonVersion = "3.10"
pythonPlatform = "All"
defineConstant = { PYDANTIC_V2 = true }
43 changes: 38 additions & 5 deletions envs/pydantic-v1/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 41 additions & 8 deletions envs/pydantic-v2/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 39 additions & 7 deletions envs/test/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions envs/test/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packages = [{ include = "githubkit-test.py" }]
[tool.poetry.dependencies]
python = "^3.9"
anyio = "*"
redis = "^5.2.0"
pytest = "^8.1.0"
pytest-cov = "^6.0.0"
pytest-xdist = "^3.5.0"
Expand Down
Loading

0 comments on commit 689cc1e

Please sign in to comment.