-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (41 loc) · 1.42 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
noop:=
space:=$(noop) $(noop)
# default target
.PHONY: help
help: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/:[^#]*##/ -- /; s/^##/\n##/'
.PHONY: pytest
pytest: ## Run pytest unit tests
PYTHONPATH=$(subst $(space),:,$(wildcard ./templates/sam/*/code/)) pytest ./templates/sam/*/tests/
#
## sceptre targets
#
.PHONY: sceptre-artifact-bucket
sceptre-artifact-bucket: ## create artifacts bucket for SAM packaging
sceptre launch --yes "s3-artifact-bucket.yaml"
.PHONY: sceptre-lambda-echo
sceptre-lambda-echo: sam-package ## launch lambda-echo stack
sceptre launch --yes "lambda-echo.yaml"
#
## SAM targets
#
PACKAGE_BUCKET = $(shell aws cloudformation describe-stacks --stack-name my-project-s3-artifact-bucket --query 'Stacks[0].Outputs[?OutputKey==`ArtifactBucketName`].OutputValue' --output text )
SAM-SUBDIRS = $(patsubst %Makefile,%$(noop),$(wildcard ./templates/sam/*/Makefile))
.PHONY: sam-package
sam-package: sceptre-artifact-bucket $(SAM-SUBDIRS) ## package all the SAM modules
# no-op
.PHONY: $(SAM-SUBDIRS)
$(SAM-SUBDIRS): ## `make package` for each SAM module; called by sam-package
cd $@ ; \
PACKAGE_BUCKET=$(PACKAGE_BUCKET) $(MAKE) package
.PHONY: clean
clean: ## remove intermediate sam-package build files
find ./templates/sam/ \
-name '__generated*' \
-o \
-name '__pycache__' \
-o \
-name '.aws-sam' \
-o \
-name '.package_bucket.txt' \
| xargs rm -rf