check: pre-commit

pre-commit:
	uv run --frozen --dev -- pre-commit run --show-diff-on-failure --color=always --all-files

test:
	uv run --frozen --dev -- python3 -m pytest -v --junitxml=laam.xml tests --ignore=tests/console/test_laa.py --ignore=tests/pythonmodule/test_laa.py

# Identity to test a real DUT
# Example:
# $ make test-dut LAA_IDENTITY=laa5home
LAA_IDENTITY ?=

check-laa-params:
ifndef LAA_IDENTITY
	$(error LAA_IDENTITY is required. Usage: make test-laa LAA_IDENTITY=<value>)
else
	$(warning Make sure that no DUT is mounted on the LAA, power commands are going to be triggered)
endif

# Not supposed to run on CI
test-laa: check-laa-params
	uv run --frozen --dev -- python3 -m pytest -v --junitxml=laam.xml tests/pythonmodule/test_laa.py --laa_identity=$(LAA_IDENTITY)
	uv run --frozen --dev -- python3 -m pytest -v --junitxml=laam.xml tests/console/test_laa.py --laa_identity=$(LAA_IDENTITY)

# Bump version, tag and push. Uses tuxpkg's release script.
# Pass VERSION=x.y.z to set an explicit version, otherwise the minor is bumped.
release:
	MODULE=laam PROJECT=laam uv run --with tuxpkg tuxpkg release
