-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
56 lines (45 loc) · 1.64 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
.DEFAULT_GOAL := help # Sets default action to be help
define PRINT_HELP_PYSCRIPT # start of Python section
import re, sys
output = []
# Loop through the lines in this file
for line in sys.stdin:
# if the line has a command and a comment start with
# two pound signs, add it to the output
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
output.append("%-10s %s" % (target, help))
# Sort the output in alphanumeric order
output.sort()
# Print the help result
print('\n'.join(output))
endef
export PRINT_HELP_PYSCRIPT # End of python section
GH_CLI := $(shell command -v gh 2> /dev/null)
ghcheck: ## Check if GH CLI is installed
ifndef GH_CLI
$(error "GitHub CLI (gh) not found on PATH. See https://cli.github.com/ to install.")
endif
help: ## Print the help text
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
changelog: ghcheck ## Fetches the changelog from the release. Requires GH CLI and correct token access permissions
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/simplicity/releases/latest > changelog.json
python utils/update_changelog.py
rm changelog.json
lint: ## Lint all the Python code
black .
ruff check . --fix
VERSION=v$(shell grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
tag: ## Tag the project for release
echo "Tagging version $(VERSION)"
git tag -a $(VERSION) -m "Creating version $(VERSION)"
git push origin $(VERSION)
test: ## Run the tests
rm -rf python_boilerplate
coverage run -m pytest . --ignore=\{\{cookiecutter.slug\}\}
coverage report -m
coverage html