-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (77 loc) · 2.65 KB
/
Makefile
File metadata and controls
98 lines (77 loc) · 2.65 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY: install install-python install-hooks lint lint-python lint-githubactions lint-githubaction-scripts test show-unused-dependencies clean clean-packages deep-clean compile download-dependencies sam-validate sam-build sam-sync sam-deploy-package
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
# install targets
install: install-python install-hooks
install-python:
poetry install
install-hooks: install-python
poetry run pre-commit install --install-hooks --overwrite
# lint targets
lint: cfn-lint lint-python lint-githubactions lint-githubaction-scripts
lint-python:
poetry run flake8 scripts/*.py --config .flake8
lint-githubactions:
actionlint
lint-githubaction-scripts:
shellcheck .github/scripts/*.sh
# test targets
test: download-dependencies
mvn test
show-unused-dependencies:
mvn dependency:analyze
# clean targets
clean-packages:
rm -f src/main/resources/package/*.tgz
clean: clean-packages
rm -rf target
mvn clean
rm -rf .aws-sam
deep-clean: clean
rm -rf .venv
rm -rf .idea
rm -rf .mvn
rm -rf src/main/main.iml
rm -rf src/test/test.iml
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
poetry env remove --all
# build targets
compile: download-dependencies
mvn package
download-dependencies:
poetry run scripts/download_dependencies.py
# SAM targets
sam-validate:
sam validate --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam validate --template-file SAMtemplates/lambda_resources.yaml --region eu-west-2
sam-build: sam-validate download-dependencies
sam build --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam-sync: guard-AWS_DEFAULT_PROFILE guard-stack_name download-dependencies
sam sync \
--stack-name $$stack_name \
--watch \
--template-file SAMtemplates/main_template.yaml
sam-deploy-package: guard-artifact_bucket guard-artifact_bucket_prefix guard-stack_name guard-template_file guard-cloud_formation_execution_role guard-LOG_LEVEL guard-LOG_RETENTION_DAYS
sam deploy \
--template-file $$template_file \
--stack-name $$stack_name \
--capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
--region eu-west-2 \
--s3-bucket $$artifact_bucket \
--s3-prefix $$artifact_bucket_prefix \
--config-file samconfig_package_and_deploy.toml \
--no-fail-on-empty-changeset \
--role-arn $$cloud_formation_execution_role \
--no-confirm-changeset \
--force-upload \
--tags "version=$$VERSION_NUMBER" \
--parameter-overrides \
EnableSplunk=true \
LogLevel=$$LOG_LEVEL \
LogRetentionDays=$$LOG_RETENTION_DAYS \
EnableAlerts=$$ENABLE_ALERTS
%:
@$(MAKE) -f /usr/local/share/eps/Mk/common.mk $@