forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (70 loc) · 2.48 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
.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
poetry install --extras "pydantic"
pre-commit install
format:
poetry run isort aws_lambda_powertools tests
poetry run black aws_lambda_powertools tests
lint: format
poetry run flake8 aws_lambda_powertools/* tests/*
test:
poetry run pytest -m "not perf" --cov=aws_lambda_powertools --cov-report=xml
poetry run pytest --cache-clear tests/performance
unit-test:
poetry run pytest tests/unit
coverage-html:
poetry run pytest -m "not perf" --cov=aws_lambda_powertools --cov-report=html
pre-commit:
pre-commit run --show-diff-on-failure
pr: lint 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
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
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
#
# 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
@echo "[+] Pre-generating CHANGELOG for tag: $$(git describe --abbrev=0 --tag)"
docker run -v "${PWD}":/workdir quay.io/git-chglog/git-chglog $$(git describe --abbrev=0 --tag).. > TMP_CHANGELOG.md
mypy:
poetry run mypy --pretty aws_lambda_powertools