-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (43 loc) · 2 KB
/
Copy pathMakefile
File metadata and controls
58 lines (43 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.PHONY: help test pre-commit lint format release dependabot-prs blast _blast add-help-to-readme init git-hooks clean
.DEFAULT_GOAL := menu
help: ## Show help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
menu:
@target=$$(awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort --reverse | fzf --ansi | awk '{print $$1}'); \
if [ -n "$$target" ]; then \
echo "Running make $$target..."; \
$(MAKE) $$target; \
fi
clean: ## Remove caches and compiled files
@find . -path './.venv' -prune -o -type f -name "*.pyc" -delete
@find . -path './.venv' -prune -o -type d -name "__pycache__" -exec rm -rf {} +
@find . -path './.venv' -prune -o -type d -name ".ruff_cache" -exec rm -rf {} +
init: git-hooks ## Initialise project for dev work
uv sync
git-hooks: ## Install git hooks
git config core.hooksPath .githooks
test: ## Run pytest
bash ./scripts/test.sh
pre-commit: ## Run pre-commit on all files
bash ./scripts/pre_commit.sh
lint: ## Run ruff linting
bash ./scripts/lint.sh
format: ## Run formatting
bash ./scripts/format.sh
release: ## Create a release commit and tag (Usage: make release VERSION=X.Y.Z)
bash ./scripts/release.sh $(VERSION)
dependabot-prs: ## List open Dependabot PRs targeting main
bash ./scripts/dependabot_prs.sh
add-help-to-readme: ## Update README.md with CLI help text
NO_COLOR=1 PYTHON_COLORS=0 uv run python scripts/add_help_to_readme.py
# (Internal) Run linters
_blast: pre-commit format lint add-help-to-readme
blast: ## Run linters and pre-commit (safely stashing untracked files)
@UNTRACKED=$$(git ls-files --others --exclude-standard); \
if [ -n "$$UNTRACKED" ]; then \
STASH_MSG="blast-stash-$$(date +%s)"; \
echo "Stashing untracked files..."; \
git stash push --include-untracked --quiet -m "$$STASH_MSG" -- $$UNTRACKED; \
trap 'echo "Restoring untracked files..."; git stash pop --quiet' EXIT INT TERM; \
fi; \
$(MAKE) _blast