Last active
December 7, 2024 05:12
-
-
Save aoirint/638802448e018ed0f1bb2a45a5f292dd to your computer and use it in GitHub Desktop.
Poetry + Ruff + Mypy Lint CI Workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'poetry' | |
- name: Install Dependencies | |
run: poetry install | |
- name: Restore lint cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
.ruff_cache | |
.mypy_cache | |
key: "${{ runner.os }}-lint-${{ github.run_id }}" | |
restore-keys: | | |
${{ runner.os }}-lint- | |
- name: Run lint | |
run: poetry run ruff check | |
- name: Run type check | |
run: poetry run mypy . | |
- name: Save lint cache | |
if: always() | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
.ruff_cache | |
.mypy_cache | |
key: "${{ runner.os }}-lint-${{ github.run_id }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.ruff] | |
target-version = "py312" | |
line-length = 88 | |
exclude = [ | |
"volumes/", | |
"backups/", | |
"work/", | |
] | |
[tool.ruff.lint] | |
select = [ | |
"E", # pycodestyle errors | |
"W", # pycodestyle warnings | |
"F", # pyflakes | |
"I", # isort | |
"B", # flake8-bugbear | |
"C4", # flake8-comprehensions | |
"UP", # pyupgrade | |
] | |
[tool.mypy] | |
strict = true | |
exclude = [ | |
"volumes/", | |
"backups/", | |
"work/", | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment