-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
123 lines (77 loc) · 2.84 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
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
113
114
115
116
117
118
119
120
121
122
123
DOCKER_COMPOSE_RUN = USER_ID=$$(id -u) docker compose --file docker/docker-compose.yml run --rm --build glue-utils
.PHONY: help
help: ## Show help (default)
@echo "=== Glue Utils ==="
@echo
@echo "Available commands:"
@grep --extended-regexp '^[ /.a-zA-Z0-9_-]+:.*?## .*$$' Makefile | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: all
all: help
.PHONY: install
install: clean ## Create virtualenv and install dependencies
@poetry install --sync
.PHONY: outdated
outdated: ## Check for outdated dependencies
@poetry show --latest --outdated
docker/requirements.txt: poetry.lock
@poetry export --with=test --output docker/requirements.txt
.PHONY: format
format: ## Format project source code
@poetry run ruff check . --fix
@poetry run ruff format .
.PHONY: lint
lint: ## Check source code for common errors
@poetry run ruff format . --check
@poetry run ruff check .
.PHONY: typecheck
typecheck: ## Check type annotations
@MYPYPATH=src poetry run mypy .
.PHONY: test
test: docker/requirements.txt ## Run automated tests
@TARGET=test $(DOCKER_COMPOSE_RUN) -c pytest
.PHONY: test-verbose
test-verbose: docker/requirements.txt ## Run automated tests in verbose mode
@TARGET=test $(DOCKER_COMPOSE_RUN) -c "pytest -vv"
.PHONY: coverage
coverage: docker/requirements.txt ## Run tests and measure code coverage
@TARGET=coverage $(DOCKER_COMPOSE_RUN) -c "pytest --cov=glue_utils --cov-report=term --cov-report=html"
.PHONY: shell
shell: docker/requirements.txt ## Enter a shell in the container
@$(DOCKER_COMPOSE_RUN) -c bash
.PHONY: checks
checks: format typecheck test
.PHONY: clean
clean: ## Delete generated artifacts
@rm -rfv __pycache__ .coverage .import_linter_cache .mypy_cache .pytest_cache .ruff_cache coverage dist htmlcov test-results
.PHONY: publish
publish: ## Publish package to PyPI
@poetry publish --build
.PHONY: bumpver-rc
bumpver-rc: ## Bump release candidate
@poetry run bumpver update --no-fetch --tag=rc --tag-num
.PHONY: bumpver-patch
bumpver-patch: ## Bump patch version
@poetry run bumpver update --no-fetch --patch --tag=final
.PHONY: bumpver-minor
bumpver-minor: ## Bump minor version
@poetry run bumpver update --no-fetch --minor --tag=final
.PHONY: bumpver-major
bumpver-major: ## Bump major version
@poetry run bumpver update --no-fetch --major --tag=final
.PHONY: githooks
githooks: ## Install/update project git hooks
@poetry run pre-commit install --install-hooks
@poetry run pre-commit autoupdate
@poetry run pre-commit run --all-files
.PHONY: release
release: publish ## Publish and tag a new release
@eval $$(bumpver show -n --environ) && git tag $$CURRENT_VERSION
@git push --follow-tags
@git push --tags
.PHONY: checkov
checkov: ## Run Checkov security checks
@checkov -d .
.PHONY: prettier
prettier: clean ## Run Prettier code formatter
@prettier --write .