diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e433eb8c..629c8763 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,6 @@ -name: Lints +name: Styling and lints on: [push, pull_request] + jobs: lint: name: Run lints @@ -8,8 +9,8 @@ jobs: - uses: actions/checkout@v6 - name: Run ruff uses: astral-sh/ruff-action@v3 - src: >- - kernels + with: + src: kernels/src kernels/tests black: name: Run black check @@ -24,28 +25,31 @@ jobs: with: python-version: 3.12 - - name: Install black - run: uv pip install black - - name: Check formatting - run: | - uv run black --check kernels + run: uv run --with black black --check kernels/src kernels/tests - validate-dependencies: - name: Validate python_depends.json + isort: + name: Run isort check runs-on: ubuntu-latest + env: + UV_PYTHON_PREFERENCE: only-managed steps: - uses: actions/checkout@v6 - - name: Set up Python - uses: actions/setup-python@v6 + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v7 with: - python-version: "3.12" - - - name: Validate python_depends.json is up-to-date - run: | - python ( cd kernels && update_python_depends.py --validate ) || { - echo "Error: python_depends.json is out of date." - echo "Please run: python update_python_depends.py" - exit 1 - } + python-version: 3.12 + + - name: Check import sorting + run: uv run --with isort isort --check-only --diff kernels/src kernels/tests + + validate-dependencies: + name: Validate shared files between Rust crate and Python package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Check python_depends.json is in sync + run: cmp -s kernel-builder/src/python_dependencies.json kernels/src/kernels/python_depends.json + diff --git a/Makefile b/Makefile index c86d71b1..3f5d5fc8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: style +.PHONY: style quality export check_dirs := kernels/src kernels/tests @@ -11,3 +11,8 @@ style: black ${check_dirs} isort ${check_dirs} ruff check ${check_dirs} --fix + +quality: + black --check ${check_dirs} + isort --check-only --diff ${check_dirs} + ruff check ${check_dirs}