forked from aws-samples/serverless-test-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (49 loc) · 1.96 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
PIP ?= pip3
target:
$(info ${HELP_MESSAGE})
@exit 0
clean: ##=> Deletes current build environment and latest build
$(info [*] Who needs all that anyway? Destroying environment....)
rm -rf ./.aws-sam/ ./venv/
checkOSDependencies:
python3 --version || grep "3.9" || (echo "Error: Requires Python 3.9" && exit 1)
all: clean build
install: checkOSDependencies
${PIP} install virtualenv
python3 -m venv venv
deps:
source ./venv/bin/activate && ${PIP} install -r tests/integration/requirements.txt
build: ##=> Same as package except that we don't create a ZIP
source ./venv/bin/activate && sam build --use-container
deploy.g: ##=> Guided deploy that is typically run for the first time only
source ./venv/bin/activate && sam build --use-container
source ./venv/bin/activate && sam deploy --guided
deploy: ##=> Deploy app using previously saved SAM CLI configuration
source ./venv/bin/activate && sam build --use-container
source ./venv/bin/activate && sam deploy
deploy.p: ##=> Deploy app to a production environment
source ./venv/bin/activate && sam deploy --parameter-overrides EnvType=prod
test: check-stack-name
source ./venv/bin/activate && AWS_SAM_STACK_NAME=$(AWS_SAM_STACK_NAME) && python3 -m pytest -s tests/integration -v
check-stack-name:
ifndef AWS_SAM_STACK_NAME
$(error usage: make AWS_SAM_STACK_NAME=<your-aws-stack-name> test)
endif
delete:
sam delete
#############
# Helpers #
#############
define HELP_MESSAGE
Usage: make <command>
Commands:
build Build Lambda function dependencies
deploy.g Deploy guided (for initial deployment)
deploy Deploy subsequent changes
install Install Pipenv, application and dev dependencies defined in Pipfile
shell Spawn a virtual environment shell
deps Install project dependencies locally
test Run integration test against cloud environment (requires AWS_SAM_STACK_NAME variable)
clean Cleans up local build artifacts including zip files
delete Delete stack from AWS
endef