forked from assertible/lambda-cloudwatch-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (36 loc) · 1.73 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
LAMBDA_TEST?=./node_modules/node-lambda/bin/node-lambda
LAMBDA_FUNCTION_NAME=
AWS_REGION=
AWS_ROLE=
AWS_PROFILE=default
CONFIG_FILE=deploy.env
all:
npm build
.PHONY: deps
deps:
npm install
.PHONY: test
test:
@test -s $(CONFIG_FILE) || { echo "No lambda config file. Update deploy.env.example and copy it to deploy.env"; exit 1; }
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-cloudwatch-event.json
.PHONY: test-all
test-all: test
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-event.json
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-elastic-beanstalk-event.json
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-codedeploy-event.json
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-codedeploy-configuration.json
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-elasticache-event.json
AWS_REGION=$(AWS_REGION) $(LAMBDA_TEST) --configFile=$(CONFIG_FILE) run -x test/context.json -j test/sns-autoscaling-event.json
.PHONY: package
package:
$(LAMBDA_TEST) package --functionName $(LAMBDA_FUNCTION_NAME)
.PHONY: deploy
deploy:
@test -s $(CONFIG_FILE) || { echo "No lambda config file. Update deploy.env.example and copy it to deploy.env"; exit 1; }
$(LAMBDA_TEST) deploy --functionName $(LAMBDA_FUNCTION_NAME) \
--role $(AWS_ROLE) \
--accessKey $(AWS_ACCESS_KEY_ID) \
--secretKey $(AWS_ACCESS_KEY_SECRET) \
--region $(AWS_REGION) \
--configFile $(CONFIG_FILE) \
--profile $(AWS_PROFILE)