-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
96 lines (83 loc) · 2.34 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
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
SHELL := /bin/bash
CFN_TEMPLATE_PATTERN ?= *.template
S3_BUCKET ?= rowanudell-2019-deployment
STACK_PREFIX ?= boc-updates
PARAMETER_SCOPE ?= /boc/updates
# Build functions
FUNCTIONDIRS := $(wildcard functions/*/.)
.PHONY: functions $(FUNCTIONDIRS)
functions: $(FUNCTIONDIRS)
$(FUNCTIONDIRS):
$(MAKE) -C $@
.PHONY: install
install: functions
# TODO: Need to install linters e.g. cfn-lint, etc
npm install
.PHONY: clean
clean:
rm -rf dist/
.PHONY: test
test:
npm run test:unit
.PHONY: lint
lint: cfn-lint vue-lint
.PHONY: vue-lint
vue-lint:
npm run lint
.PHONY: cfn-lint
cfn-lint:
yamllint --strict ${CFN_TEMPLATE_PATTERN}
cfn-lint -t ${CFN_TEMPLATE_PATTERN}
.PHONY: data.template
data.template:
aws cloudformation deploy \
--stack-name ${STACK_PREFIX}-data \
--template-file data.template \
--parameter-overrides \
ParameterScope=${PARAMETER_SCOPE} \
--no-fail-on-empty-changeset
.PHONY: scrapers.template
scrapers.template: functions
aws cloudformation package \
--template-file $@ \
--s3-bucket ${S3_BUCKET} \
--output-template-file [email protected]
aws cloudformation deploy \
--stack-name ${STACK_PREFIX}-scrapers \
--template-file [email protected] \
--parameter-overrides \
ActiveTableName=${PARAMETER_SCOPE}/tables/active/name \
--capabilities CAPABILITY_IAM \
--no-fail-on-empty-changeset
.PHONY: api.template
api.template: functions
aws cloudformation package \
--template-file $@ \
--s3-bucket ${S3_BUCKET} \
--output-template-file [email protected]
aws cloudformation deploy \
--stack-name ${STACK_PREFIX}-api \
--template-file [email protected] \
--parameter-overrides \
ActiveTableName=${PARAMETER_SCOPE}/tables/active/name \
ParameterScope=${PARAMETER_SCOPE} \
--capabilities CAPABILITY_IAM \
--no-fail-on-empty-changeset
.PHONY: site.template
site.template:
aws cloudformation deploy \
--stack-name ${STACK_PREFIX}-site \
--no-fail-on-empty-changeset \
--template-file site.template
# NOTE: Pipeline must already be deployed with GitHub details
.PHONY: pipeline.template
pipeline.template:
aws cloudformation deploy \
--stack-name ${STACK_PREFIX}-pipeline \
--template-file pipeline.template \
--parameter-overrides \
ParameterScope=${PARAMETER_SCOPE} \
SiteBucketArn=${PARAMETER_SCOPE}/site/bucket/arn \
SiteBucketName=${PARAMETER_SCOPE}/site/bucket/name \
--capabilities CAPABILITY_IAM \
--no-fail-on-empty-changeset