-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (47 loc) · 1.92 KB
/
Makefile
File metadata and controls
56 lines (47 loc) · 1.92 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
BLUE := \033[1;34m
GREEN := \033[1;32m
RESET := \033[0m
PYTHON_VERSIONS := 3.11.13 3.12.10 3.13.9
.PHONY: tests format check check-matrix all prod rename
# Hack to allow passing arguments to make commands (e.g. make rename my_project)
ifeq (rename,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "rename"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
rename:
@if [ -z "$(RUN_ARGS)" ]; then \
echo "Error: Name is not provided. Usage: make rename my_awesome_project"; \
exit 1; \
fi
@printf "$(BLUE)==>$(RESET) Renaming vcode to $(RUN_ARGS)...\n"
@python3 scripts/rename_workspace.py $(RUN_ARGS) || python scripts/rename_workspace.py $(RUN_ARGS)
@printf "$(GREEN)✔ Project renamed to $(RUN_ARGS) successfully!$(RESET)\n"
format:
@printf "$(BLUE)==>$(RESET) Formatting code with ruff...\n"
@uv run ruff format
@printf "$(GREEN)✔ Formatting complete.$(RESET)\n"
check:
@printf "$(BLUE)==>$(RESET) Running ruff checks...\n"
@uv run ruff check
@printf "$(BLUE)==>$(RESET) Type checking with ty...\n"
@uv run ty check
@printf "$(BLUE)==>$(RESET) Type checking with basedpyright...\n"
@uv run basedpyright
@printf "$(GREEN)✔ Checking complete.$(RESET)\n"
check-matrix:
@for version in $(PYTHON_VERSIONS); do \
short_version=$${version%.*}; \
printf "$(BLUE)==>$(RESET) Running validation matrix for Python $$version...\n"; \
uv run --python $$version ruff check src/vcode tests || exit $$?; \
uv run --python $$version ty check --python-version $$short_version || exit $$?; \
uv run --python $$version basedpyright --pythonversion $$short_version || exit $$?; \
done
@printf "$(GREEN)✔ Matrix checking complete.$(RESET)\n"
tests:
@printf "$(BLUE)==>$(RESET) Running tests with pytest...\n"
@uv run pytest
@printf "$(GREEN)✔ Tests complete.$(RESET)\n"
all: format check
prod: tests format check-matrix