-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (97 loc) · 2.67 KB
/
Makefile
File metadata and controls
112 lines (97 loc) · 2.67 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
SHELL:=/bin/bash
SUPPORTED_COMMANDS := test
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
COMMAND_ARGS := $(subst :,\:,$(COMMAND_ARGS))
$(eval $(COMMAND_ARGS):;@:)
endif
# Git workflow commands
.PHONY: wip
wip:
git add .
git commit -m "WIP: Work in progress"
git push
# Install command
.PHONY: install
install:
uv sync --python $${PYTHON_VERSION:-3.13} --all-extras --dev
# Build command
.PHONY: build
build: check-version
rm -rf dist/* || true
# ls -al
./scripts/version.sh "${VERSION}"
@cat pyproject.toml | grep version
@cat pydocks/__init__.py | grep version
uv build --python $${PYTHON_VERSION:-3.13}
.PHONY: check-version
check-version:
@if [ -z "${VERSION}" ]; then \
echo "VERSION is not set. Please set the VERSION environment variable."; \
exit 1; \
fi
.PHONY: check
check:
echo "Run pyright"
PYRIGHT_PYTHON_FORCE_VERSION=latest uv run pyright
.PHONY: check-docker
check-docker:
echo "check-docker"
ifeq ($(strip $(CI)),)
echo "ci is not set"
ifeq ($(shell uname),Darwin)
# we use colima in MacOs
which colima &>/dev/null || echo "You must install colima"
docker info > /dev/null 2>&1 || colima stop
docker info > /dev/null 2>&1 || colima start --cpu 4 --memory 12
else
echo "docker must be started"
endif
endif
# Deploy command
.PHONY: deploy
deploy:
uvx twine upload dist/*
# Install local build command
.PHONY: install-local
install-local:
pip3 install dist/*.whl
# Test command
.PHONY: test
test: check-docker
@echo "Modified arguments: $(COMMAND_ARGS)"
@if [ -z "$(COMMAND_ARGS)" ]; then \
uv run --python $${PYTHON_VERSION:-3.13} pytest -v --log-cli-level=INFO; \
else \
uv run --python $${PYTHON_VERSION:-3.13} pytest -v --log-cli-level=INFO $(COMMAND_ARGS); \
fi
# Lint command
.PHONY: lint
lint:
uv run ruff check --fix
uv run ruff format
uv run ruff format --check
# Update dependencies
.PHONY: update
update:
uv lock --upgrade
uv sync
# Check for outdated dependencies
.PHONY: check-deps
check-deps:
.venv/bin/pip list --outdated
# Display all available commands
.PHONY: help
help:
@echo "Available commands:"
@echo " wip - Commit and push work in progress"
@echo " install - Install dependencies"
@echo " build - Build the project"
@echo " deploy - Deploy the project"
@echo " install-local - Install the build locally"
@echo " update - Update dependencies"
@echo " check-deps - Check for outdated dependencies"
@echo " test - Run tests"
@echo " lint - Run linter"
@echo " help - Display this help message"