build(make): add lint target and run it as part of make test
`make lint` runs ruff on src and tests directly on the host, using the same invocation as the lint-python workflow so local and CI agree. The script fails with a clear install hint when ruff is not on PATH. `make test` now depends on `lint`, so linting runs before the container images are built. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
Makefile
12
Makefile
@@ -2,6 +2,7 @@
|
|||||||
build build-no-cache build-no-cache-all build-missing \
|
build build-no-cache build-no-cache-all build-missing \
|
||||||
delete-volumes purge \
|
delete-volumes purge \
|
||||||
test test-unit test-e2e test-integration test-env-virtual test-env-nix \
|
test test-unit test-e2e test-integration test-env-virtual test-env-nix \
|
||||||
|
lint \
|
||||||
setup setup-venv setup-nix
|
setup setup-venv setup-nix
|
||||||
|
|
||||||
# Distro
|
# Distro
|
||||||
@@ -82,6 +83,13 @@ build-no-cache-all:
|
|||||||
PKGMGR_DISTRO="$$d" $(MAKE) build-no-cache; \
|
PKGMGR_DISTRO="$$d" $(MAKE) build-no-cache; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Lint targets (run on the host, not in a container)
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
|
lint:
|
||||||
|
@bash scripts/lint/python.sh
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Test targets (delegated to scripts/test)
|
# Test targets (delegated to scripts/test)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@@ -101,8 +109,8 @@ test-env-virtual: build-missing
|
|||||||
test-env-nix: build-missing
|
test-env-nix: build-missing
|
||||||
@bash scripts/test/test-env-nix.sh
|
@bash scripts/test/test-env-nix.sh
|
||||||
|
|
||||||
# Combined test target for local + CI (unit + integration + e2e)
|
# Combined test target for local + CI (lint + unit + integration + e2e)
|
||||||
test: test-env-virtual test-unit test-integration test-e2e
|
test: lint test-env-virtual test-unit test-integration test-e2e
|
||||||
|
|
||||||
delete-volumes:
|
delete-volumes:
|
||||||
@docker volume rm "pkgmgr_nix_store_${PKGMGR_DISTRO}" "pkgmgr_nix_cache_${PKGMGR_DISTRO}" || echo "No volumes to delete."
|
@docker volume rm "pkgmgr_nix_store_${PKGMGR_DISTRO}" "pkgmgr_nix_cache_${PKGMGR_DISTRO}" || echo "No volumes to delete."
|
||||||
|
|||||||
15
scripts/lint/python.sh
Executable file
15
scripts/lint/python.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "============================================================"
|
||||||
|
echo ">>> Running RUFF lint on src and tests (local, no container)"
|
||||||
|
echo "============================================================"
|
||||||
|
|
||||||
|
if ! command -v ruff >/dev/null 2>&1; then
|
||||||
|
echo "ruff is not installed or not on PATH." >&2
|
||||||
|
echo "Install it with: pip install ruff" >&2
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
|
||||||
|
ruff --version
|
||||||
|
ruff check src tests
|
||||||
Reference in New Issue
Block a user