generated from ran-isenberg/aws-lambda-handler-cookbook
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (50 loc) · 1.94 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
.PHONY: dev lint complex coverage pre-commit sort deploy destroy deps unit infra-tests integration e2e coverage-tests docs lint-docs build format compare-openapi openapi
PYTHON := ".venv/bin/python3"
.ONESHELL: # run all commands in a single shell, ensuring it runs within a local virtual env
OPENAPI_DIR := ./docs/swagger
CURRENT_OPENAPI := $(OPENAPI_DIR)/openapi.json
LATEST_OPENAPI := openapi_latest.json
dev:
pip install --upgrade pip pre-commit poetry
pre-commit install
# ensures poetry creates a local virtualenv (.venv)
poetry config --local virtualenvs.in-project true
poetry install --no-root
npm ci
format:
poetry run ruff check . --fix
format-fix:
poetry run ruff format .
lint: format
@echo "Running mypy"
$(MAKE) mypy-lint
complex:
@echo "Running Radon"
poetry run radon cc -e 'tests/*,cdk.out/*,node_modules/*' .
@echo "Running xenon"
poetry run xenon --max-absolute B --max-modules A --max-average A -e 'tests/*,.venv/*,cdk.out/*,node_modules/*' .
pre-commit:
poetry run pre-commit run -a --show-diff-on-failure
mypy-lint:
poetry run mypy --pretty service cdk tests
deps:
poetry export --only=dev --format=requirements.txt > dev_requirements.txt
poetry export --without=dev --format=requirements.txt > lambda_requirements.txt
unit:
poetry run pytest tests/unit --cov-config=.coveragerc --cov=service --cov-report xml
build: deps
mkdir -p .build/lambdas ; cp -r service .build/lambdas
mkdir -p .build/common_layer ; poetry export --without=dev --format=requirements.txt > .build/common_layer/requirements.txt
integration:
poetry run pytest tests/integration --cov-config=.coveragerc --cov=service --cov-report xml
pr: deps format pre-commit complex lint deploy integration
deploy: build
npx cdk deploy --app="${PYTHON} ${PWD}/app.py" --require-approval=never
destroy:
npx cdk destroy --app="${PYTHON} ${PWD}/app.py" --force
watch:
npx cdk watch
update-deps:
poetry update
pre-commit autoupdate
npm i --package-lock-only