.PHONY: all
all: format lint type_check test

.PHONY: test
test:
	pytest .

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

.PHONY: lint
lint:
	ruff check --fix .

.PHONY: format
format:
	ruff format .

.PHONY: type_check
type_check:
	pyright pydaraja/

.PHONY: clean
clean:
	rm -rf .pytest_cache .tox dist .coverage pydaraja.egg-info build celerybeat-schedule .ruff_cache .testmondata .eggs
	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

.PHONY: publish
publish:
	tox -e publish

.PHONY: help
help:
	@echo "Usage:"
	@echo "  make"
	@echo "  	Run ruff, pyright & 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 "  	Auto-format Python code"
	@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"
	@echo "  make publish"
	@echo "  	Upload the built package to pypi"
	@echo "  make help"
	@echo "  	Display usage information"
