Skip to content

CI: run ruff lint and format check #103

CI: run ruff lint and format check

CI: run ruff lint and format check #103

Workflow file for this run

name: tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: pysetup
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install
run: |
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: |
# CI runners have no configured git. Need that for git support tests.
git config --global user.name "Gaylord Focker"
git config --global user.email "[email protected]"
# Run parallel tests (-n flag). Detect all $(pwd)/tests/test_*.py
pytest -n4