Skip to content

Commit

Permalink
Reorganize github workflows: one check on push+pr, one check+format t…
Browse files Browse the repository at this point in the history
…hen commit, only on push on master
  • Loading branch information
Félix Piédallu committed Mar 14, 2024
1 parent 751ff67 commit e03e960
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 44 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/autoblack.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Python Ruff Lint and commit
name: Python Lint with Ruff and Mypy

on:
pull_request:
push:
branches: [master]
pull_request:

jobs:
ruff:
Expand All @@ -12,14 +12,14 @@ jobs:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
- name: Install Ruff
- name: Install Ruff and Mypy
run: pip install ruff

- name: Ruff check and fix
- name: Ruff check
run: |
ruff check .
ruff fix .
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Python style fixes from Ruff'
- name: mypy check
run: |
yes | mypy src --install-types || true
mypy .
32 changes: 32 additions & 0 deletions .github/workflows/python-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python formatting with Black and Ruff

on:
push:
branches: [master]

jobs:
format:
name: Formatting with Black and Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check files using the black formatter
uses: psf/black@stable
id: black
with:
options: "."
continue-on-error: true

- uses: actions/setup-python@v2
- name: Install Ruff
run: pip install ruff

- name: Ruff check and fix
run: |
ruff check .
ruff check --fix .
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Python formatting fixes from Black and Ruff'
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.black]
line-length = 120

[tool.ruff]
line-length = 120

[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle
"W", # pycodestyle
"I", # isort
"N", # pep8-naming
"B", # flake8-ubgbear
"ANN", # flake8-annotations
"Q", # flake8-quotes
"PTH", # flake8-use-pathlib
"UP", # pyupgrade,
]

[tool.mypy]

0 comments on commit e03e960

Please sign in to comment.