-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (43 loc) · 1.39 KB
/
Makefile
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
# Variables
VENV_NAME=.venv
PYTHON=$(VENV_NAME)/bin/python
PIP=$(VENV_NAME)/bin/pip
VERSION=$(shell cat VERSION)
# For Windows, use these paths
# PYTHON=$(VENV_NAME)/Scripts/python
# PIP=$(VENV_NAME)/Scripts/pip
# Check if a package is installed
define is_installed
$(PYTHON) -c "import $1" >/dev/null 2>&1 || { echo >&2 "Installing $1..."; $(PIP) install $1; }
endef
# Targets
all: venv install_deps generate_files
venv:
python3 -m venv $(VENV_NAME)
install_deps: venv
$(PIP) install -r requirements.txt
generate_files:
$(PYTHON) run.py
install_dev_deps: venv
$(PIP) install -r requirements-dev.txt
format_deps: install_dev_deps
$(call is_installed,isort)
$(call is_installed,black)
lint_deps: install_dev_deps
$(call is_installed,flake8)
format: format_deps
$(VENV_NAME)/bin/isort .
$(VENV_NAME)/bin/black .
lint: lint_deps
$(VENV_NAME)/bin/flake8 .
release: changelog
git tag -a v$(VERSION) -m "Release version $(VERSION)"
git push origin v$(VERSION)
gh release create v$(VERSION) --title "Release version $(VERSION)" --notes-file CHANGELOG.md
changelog:
@echo "## Version $(VERSION) - Release Notes" > CHANGELOG.md
@echo "" >> CHANGELOG.md
@echo "- Initial release with base features" >> CHANGELOG.md
clean:
rm -rf $(VENV_NAME) aliases.md aliases.html aliases.pdf
.PHONY: all venv install_deps generate_files install_dev_deps format_deps lint_deps format lint release changelog clean