-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (50 loc) · 1.43 KB
/
Makefile
File metadata and controls
57 lines (50 loc) · 1.43 KB
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
MAKEFLAGS += --warn-undefined-variables
SHELL := sh
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.PHONY: help clean build test verify invoke-sam
## display this help
help:
@ echo 'Usage: make <target>'
@ echo
@ echo 'Available targets are:'
@ awk '/^[[:alnum:]]+([\.\-_][[:alnum:]]*)*:/ { \
if (match(line, /^## (.*)/)) { printf " %s,%s\n", substr($$1, 0, index($$1, ":")-1), substr(line, RSTART + 3, RLENGTH); } \
} { line = $$0 }' $(MAKEFILE_LIST) | sort | column -t -s,
@ echo
## build lambda using own controlled process
build:
### $@
time make -C myfunction build
tree -a
@ echo
@ echo '-----'
@ echo 'CONS:'
@ echo ' - requires contract-based design (framework)'
@ echo ' - requires to use "aws cloudformation package" to upload code'
@ echo
## run tests locally
test:
python3.7 -m unittest discover -s myfunction/test -v
## run docker
verify:
### $@
time make -C myfunction verify
@ echo
@ echo '-----'
@ echo 'CONS:'
@ echo ' - requires contract-based design (framework)'
@ echo
## run sam local invoke
invoke-sam:
### $@
time sam local invoke --skip-pull-image --no-event MyFunction
## clean up
clean:
### $@
find . -type f -name '*.pyc' -print0 | xargs -r -0 rm -rf
find . -type d -name '__pycache__' -print0 | xargs -r -0 rm -rf
find . -type d -name '*.dist-info' -print0 | xargs -r -0 rm -rf
find . -type d -name '*.egg-info' -print0 | xargs -r -0 rm -rf
rm -rf .aws-sam
make -C myfunction $@