Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add pyright checking workflow #185

Merged
merged 8 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading