.PHONY: all
all: format lint type_check test

.PHONY: pkg_check
pkg_check:
	uv pip check

.PHONY: test
test:
	pytest tests

.PHONY: test_incr
test_incr:
	pytest tests --testmon --no-cov -n 0

.PHONY: lint
lint:
	ruff check --fix .
	bash commit_lint.sh

.PHONY: format
format:
	ruff format .

.PHONY: type_check
type_check:
	pyright id_tracker/

.PHONY: clean
clean:
	rm -rf .pytest_cache .tox dist .coverage sil_recon.egg-info build celerybeat-schedule .ruff_cache .testmondata
	py3clean .

.PHONY: changelog
changelog:
	git-changelog --style conventional \
		--sections feat,fix,chore,revert,refactor,perf,build,ci,deps,docs,style,test \
		--template keepachangelog \
		--bump=auto \
		-o CHANGELOG.md

.PHONY: package
package:
	tox -e package
	tox -e publish

.PHONY: help
help:
	@echo "Usage:"
	@echo "  make"
	@echo "  	Run ruff & pytest"
	@echo "  make test"
	@echo "  	Run pytest & output coverage results"
	@echo "  make test_incr"
	@echo "  	Run only tests with recent changes (speedup!)"
	@echo "  make lint"
	@echo "  	Run the ruff linter"
	@echo "  make format"
	@echo "  	Run the ruff formatter"
	@echo "  make type_check"
	@echo "  	Run static type checking with pyright"
	@echo "  make clean"
	@echo "  	Remove autogenerated files like __py_cache__"
	@echo "  make changelog"
	@echo "  	Update the CHANGELOG"
	@echo "  make package"
	@echo "  	Build the package and upload it"
	@echo "  make help"
	@echo "  	Display usage information"
