-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (53 loc) · 2.08 KB
/
Makefile
File metadata and controls
67 lines (53 loc) · 2.08 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
59
60
61
62
63
64
65
66
67
.PHONY: all
all: .venv circuitpython-workspaces/typeshed pre-commit-install
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Development
.venv: ## Create a virtual environment
@echo "Creating virtual environment..."
@$(MAKE) uv
@$(UV) venv
@$(UV) pip install --requirement pyproject.toml
circuitpython-workspaces/typeshed: ## Install CircuitPython typeshed stubs
@echo "Installing CircuitPython typeshed stubs..."
@$(MAKE) uv
@$(UV) pip install circuitpython-typeshed==0.1.0 --target circuitpython-workspaces/typeshed
.PHONY: pre-commit-install
pre-commit-install: uv
@echo "Installing pre-commit hooks..."
@$(UVX) pre-commit install > /dev/null
.PHONY: fmt
fmt: pre-commit-install ## Lint and format files
$(UVX) pre-commit run --all-files
.PHONY: typecheck
typecheck: .venv circuitpython-workspaces/typeshed ## Run type check
@$(UV) run -m pyright --project=circuitpython-workspaces circuitpython-workspaces/
@$(UV) run -m pyright --project=cpython-workspaces cpython-workspaces/
.PHONY: test
test: .venv ## Run tests
$(UV) run coverage run --rcfile=pyproject.toml -m pytest cpython-workspaces/flight-software-unit-tests/src
@$(UV) run coverage html --rcfile=pyproject.toml > /dev/null
@$(UV) run coverage xml --rcfile=pyproject.toml > /dev/null
.PHONY: clean
clean: ## Remove all gitignored files
git clean -dfX
##@ Build Tools
TOOLS_DIR ?= tools
$(TOOLS_DIR):
mkdir -p $(TOOLS_DIR)
### Tool Versions
UV_VERSION ?= 0.8.14
UV_DIR ?= $(TOOLS_DIR)/uv-$(UV_VERSION)
UV ?= $(UV_DIR)/uv
UVX ?= $(UV_DIR)/uvx
.PHONY: uv
uv: $(UV) ## Download uv
$(UV): $(TOOLS_DIR)
@test -s $(UV) || { mkdir -p $(UV_DIR); curl -LsSf https://astral.sh/uv/$(UV_VERSION)/install.sh | UV_INSTALL_DIR=$(UV_DIR) sh > /dev/null; }
.PHONY: docs
docs: uv
@$(UV) run --group docs mkdocs serve
.PHONY: docs-deploy
docs-deploy: uv
@$(UV) run --group docs mkdocs gh-deploy --config-file mkdocs.yaml --force