Skip to content

Commit

Permalink
CI: run ruff lint and format check
Browse files Browse the repository at this point in the history
For that, addd ruff to "dev" deps in pyproject.toml .
  • Loading branch information
elcorto committed Feb 15, 2024
1 parent ac6647d commit 1e1acf0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
tests:
strategy:
fail-fast: false
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest]
Expand All @@ -30,7 +30,28 @@ jobs:

- name: install
run: |
pip install -e ".[test,dask]"
pip install -e ".[test,dask,dev]"
# We run this for each Python version in the matrix which is redundant,
# but since ruff is fast, that's OK. We like to make sure that we install
# the ruff version from pyproject.toml, which we achieve by
#
# pip install -e ".[dev]"
#
# Doing this in another workflow such as lint.yml would install psweep +
# all deps again just for linting.
#
# The alternative would be to say
#
# pip install ruff==<version>
#
# but then we duplicate version information, which has to be maintained.
- name: lint
run: |
# Check for lint rules.
ruff check .
# Check if files need to be formatted. Exit non-zero if the case.
ruff format --check .
- name: run tests
run: |
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ test = [
"pytest-xdist",
]

dev = ["pre-commit"]
# We need to sync the ruff version here with the one in
# .pre-commit-config.yaml, ahh well.
dev = [
"pre-commit",
"ruff == 0.2.1",
]


# See doc/requirements.txt
#
Expand Down

0 comments on commit 1e1acf0

Please sign in to comment.