-
Notifications
You must be signed in to change notification settings - Fork 397
/
Makefile
118 lines (88 loc) · 3.34 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
.PHONY: target dev format lint test coverage-html pr build build-docs build-docs-api build-docs-website
.PHONY: docs-local docs-api-local security-baseline complexity-baseline release-prod release-test release
target:
@$(MAKE) pr
dev:
pip install --upgrade pip pre-commit poetry
@$(MAKE) dev-version-plugin
poetry install --extras "all redis datamasking"
pre-commit install
dev-gitpod:
pip install --upgrade pip poetry
poetry install --extras "all redis datamasking"
pre-commit install
format:
poetry run black aws_lambda_powertools tests examples
lint: format
poetry run ruff check aws_lambda_powertools tests examples
lint-docs:
docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli "docs"
lint-docs-fix:
docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli --fix "docs"
test:
poetry run pytest -m "not perf" --ignore tests/e2e --cov=aws_lambda_powertools --cov-report=xml
poetry run pytest --cache-clear tests/performance
test-dependencies:
poetry run nox --error-on-external-run --reuse-venv=yes --non-interactive
test-pydanticv2:
poetry run pytest -m "not perf" --ignore tests/e2e
unit-test:
poetry run pytest tests/unit
e2e-test:
poetry run pytest tests/e2e
coverage-html:
poetry run pytest -m "not perf" --ignore tests/e2e --cov=aws_lambda_powertools --cov-report=html
pre-commit:
pre-commit run --show-diff-on-failure
pr: lint lint-docs mypy pre-commit test security-baseline complexity-baseline
build: pr
poetry build
release-docs:
@echo "Rebuilding docs"
rm -rf site api
@echo "Updating website docs"
poetry run mike deploy --push --update-aliases ${VERSION} ${ALIAS}
@echo "Building API docs"
@$(MAKE) build-docs-api VERSION=${VERSION}
build-docs-api:
poetry run pdoc --html --output-dir ./api/ ./aws_lambda_powertools --force
mv -f ./api/aws_lambda_powertools/* ./api/
rm -rf ./api/aws_lambda_powertools
mkdir ${VERSION} && cp -R api ${VERSION}
docs-local:
poetry run mkdocs serve
docs-local-docker:
docker build -t squidfunk/mkdocs-material ./docs/
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
docs-api-local:
poetry run pdoc --http : aws_lambda_powertools
security-baseline:
poetry run bandit --baseline bandit.baseline -r aws_lambda_powertools
complexity-baseline:
$(info Maintenability index)
poetry run radon mi aws_lambda_powertools
$(info Cyclomatic complexity index)
poetry run xenon --max-absolute C --max-modules A --max-average A aws_lambda_powertools --exclude aws_lambda_powertools/shared/json_encoder.py,aws_lambda_powertools/utilities/validation/base.py
#
# Use `poetry version <major>/<minor></patch>` for version bump
#
release-prod:
poetry config pypi-token.pypi ${PYPI_TOKEN}
poetry publish -n
release-test:
poetry config repositories.testpypi https://test.pypi.org/legacy
poetry config pypi-token.pypi ${PYPI_TEST_TOKEN}
poetry publish --repository testpypi -n
release: pr
poetry build
$(MAKE) release-test
$(MAKE) release-prod
changelog:
git fetch --tags origin
CURRENT_VERSION=$(shell git describe --abbrev=0 --tag) ;\
echo "[+] Pre-generating CHANGELOG for tag: $$CURRENT_VERSION" ;\
docker run -v "${PWD}":/workdir quay.io/git-chglog/git-chglog:0.15.1 > CHANGELOG.md
mypy:
poetry run mypy --pretty aws_lambda_powertools examples
dev-version-plugin:
poetry self add git+https://github.com/monim67/poetry-bumpversion@315fe3324a699fa12ec20e202eb7375d4327d1c4