Skip to content

Commit 689cc1e

Browse files
authored
👷 CI: add pyright checking workflow (#185)
1 parent c7154c6 commit 689cc1e

File tree

9 files changed

+260
-82
lines changed

9 files changed

+260
-82
lines changed

.github/workflows/pyright.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Pyright Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
paths:
9+
- "envs/**"
10+
- "githubkit/**"
11+
- "tests/**"
12+
- "codegen/**"
13+
- ".github/actions/setup-python/**"
14+
- ".github/workflows/pyright.yml"
15+
- "**/pyproject.toml"
16+
- "**/poetry.lock"
17+
18+
jobs:
19+
lint-githubkit:
20+
name: GitHubKit Lint
21+
runs-on: ubuntu-latest
22+
concurrency:
23+
group: pyright-${{ github.ref }}-${{ matrix.env }}
24+
cancel-in-progress: true
25+
strategy:
26+
matrix:
27+
env: [pydantic-v1, pydantic-v2]
28+
fail-fast: false
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Setup Python environment
34+
uses: ./.github/actions/setup-python
35+
with:
36+
env-dir: ./envs/${{ matrix.env }}
37+
no-root: true
38+
39+
- run: |
40+
(cd ./envs/${{ matrix.env }} && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH)
41+
if [ "${{ matrix.env }}" = "pydantic-v1" ]; then
42+
sed -i 's/PYDANTIC_V2 = true/PYDANTIC_V2 = false/g' ./pyproject.toml
43+
fi
44+
shell: bash
45+
46+
- name: Run Pyright
47+
uses: jakebailey/pyright-action@v2
48+
with:
49+
pylance-version: latest-release
50+
51+
lint-codegen:
52+
name: Codegen Lint
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Setup Python environment
59+
uses: ./.github/actions/setup-python
60+
with:
61+
env-dir: .
62+
63+
- run: |
64+
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
65+
shell: bash
66+
67+
- name: Run Pyright
68+
uses: jakebailey/pyright-action@v2
69+
with:
70+
working-directory: ./codegen
71+
pylance-version: latest-release

codegen/pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ target-version = "py310"
55

66
[tool.ruff.lint]
77
ignore = ["TID"]
8+
9+
[tool.pyright]
10+
typeCheckingMode = "standard"
11+
reportPrivateImportUsage = false
12+
reportShadowedImports = false
13+
disableBytesTypePromotions = true
14+
15+
pythonVersion = "3.10"
16+
pythonPlatform = "All"
17+
defineConstant = { PYDANTIC_V2 = true }

envs/pydantic-v1/poetry.lock

Lines changed: 38 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

envs/pydantic-v2/poetry.lock

Lines changed: 41 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

envs/test/poetry.lock

Lines changed: 39 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

envs/test/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ packages = [{ include = "githubkit-test.py" }]
99
[tool.poetry.dependencies]
1010
python = "^3.9"
1111
anyio = "*"
12+
redis = "^5.2.0"
1213
pytest = "^8.1.0"
1314
pytest-cov = "^6.0.0"
1415
pytest-xdist = "^3.5.0"

0 commit comments

Comments
 (0)