Skip to content

Commit

Permalink
use pre-commit.ci, remove workflow step running pre-commit. Add pyrig…
Browse files Browse the repository at this point in the history
…ht step to CI workflow.
  • Loading branch information
jakkdl committed Feb 21, 2024
1 parent 953a945 commit 589dea0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ on:
branches: [main]

jobs:
check:
# pyright can't run in pre-commit CI as it requires an internet connection
# so we instead run it directly as a GitHub action
pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools pre-commit
- name: Run checks
run: |
pre-commit run --all-files
cache: pip
- name: Install typing dependencies
run: pip install -r requirements-typing.txt
- uses: jakebailey/pyright-action@v2
with:
# Use exit code of 1 if warnings are reported.
warnings: true


test:
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ repos:
# ignore warnings about new version being available, no other warnings
# are suppressed by this.
entry: env PYRIGHT_PYTHON_IGNORE_WARNING=true pyright
args: [--pythonversion=3.11, --warnings]
# exit with non-zero on warnings
args: [--warnings]
# Required for pyright strict mode
# Mirrors content of requirements-typing.txt, as pre-commit does not allow
# reading from that for caching reasons.
additional_dependencies:
# Required for pyright strict mode
- anyio
- flake8
- GitPython
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ warn_unused_ignores = false

[tool.pyright]
exclude = ["**/node_modules", "**/__pycache__", "**/.*", "tests/eval_files/*", "tests/autofix_files/*"] # TODO: fix errors in eval/autofix files
pythonVersion = "3.12"
reportCallInDefaultInitializer = true
reportImplicitStringConcatenation = false # black generates implicit string concats
reportMissingSuperCall = true
Expand Down
7 changes: 7 additions & 0 deletions requirements-typing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
anyio
flake8
GitPython
hypothesis
hypothesmith
pytest
trio

0 comments on commit 589dea0

Please sign in to comment.