44 lines
1.2 KiB
Makefile
44 lines
1.2 KiB
Makefile
UV := uv
|
|
|
|
.PHONY: format lint typecheck test ci-check build publish-gitea clean-branches
|
|
|
|
format:
|
|
$(UV) run ruff format .
|
|
$(UV) run ruff check . --fix
|
|
|
|
lint:
|
|
$(UV) run ruff check .
|
|
|
|
typecheck:
|
|
$(UV) run mypy --config-file pyproject.toml
|
|
|
|
test:
|
|
$(UV) run pytest
|
|
|
|
ci-check:
|
|
$(UV) run ruff check .
|
|
$(UV) run mypy --config-file pyproject.toml
|
|
$(UV) run deptry .
|
|
|
|
build:
|
|
$(UV) build
|
|
|
|
publish-gitea:
|
|
@test -n "$$GITEA_PYPI_REPOSITORY_URL" || (echo "GITEA_PYPI_REPOSITORY_URL is required" && exit 1)
|
|
@test -n "$$GITEA_PACKAGE_USERNAME" || (echo "GITEA_PACKAGE_USERNAME is required" && exit 1)
|
|
@test -n "$$GITEA_PACKAGE_TOKEN" || (echo "GITEA_PACKAGE_TOKEN is required" && exit 1)
|
|
$(UV) build
|
|
$(UV) run --with twine twine check dist/*
|
|
TWINE_REPOSITORY_URL="$$GITEA_PYPI_REPOSITORY_URL" \
|
|
TWINE_USERNAME="$$GITEA_PACKAGE_USERNAME" \
|
|
TWINE_PASSWORD="$$GITEA_PACKAGE_TOKEN" \
|
|
$(UV) run --with twine twine upload dist/*
|
|
|
|
clean-branches:
|
|
ifeq ($(OS),Windows_NT)
|
|
@git fetch --prune
|
|
@cmd /C "for /f \"tokens=1\" %%i in ('git branch -vv ^| findstr ": gone]"') do git branch -D %%i" || ver > nul
|
|
else
|
|
git fetch --prune
|
|
git branch -vv | grep ': gone]' | awk '{print $$1}' | xargs -r git branch -D
|
|
endif |