generated from nhs-england-tools/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
90 lines (70 loc) · 2.48 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
include scripts/init.mk
config:
make \
asdf-install \
githooks-install \
nodejs-install \
terraform-install
.SILENT: \
config
###############
## Constants ##
###############
BUILD_FOLDER = build
REQUIRED_BUILD_DEPENDENCIES = yarn
REQUIRED_RUNTIME_DEPENDENCIES = node terraform
#####################
## Install Targets ##
#####################
install-tflint:
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
install-precommit:
python scripts/pre-commit/pre-commit.pyz install
##############################
## Dependency Check Targets ##
##############################
check: check-runtime-deps check-build-deps # Checks if runtime and build requirements are available
check-runtime-deps:
$(foreach exec,${REQUIRED_RUNTIME_DEPENDENCIES},\
$(if $(shell which ${exec}),@echo -e "${exec} is installed\n",$(error "No ${exec} in PATH")))
check-build-deps:
$(foreach exec,${REQUIRED_BUILD_DEPENDENCIES},\
$(if $(shell which ${exec}),@echo -e "${exec} is installed",$(error "No ${exec} in PATH")))
##########################
# Variable Check Targets #
##########################
check-version: # Checks for the presence of the $version variable
ifeq ("${version}", "")
$(error "Variable 'version' was not provided")
endif
################################
# CloudFront Logs Lambda Build #
################################
install-cloudfront-logs-lambda: # Installs CloudFront Logs Lambda Dependencies
yarn --cwd modules/cloudfront-logs/lambda install
build-cloudfront-logs-lambda:
yarn --cwd modules/cloudfront-logs/lambda build
###########################
## Example Build Targets ##
###########################
example-clean: # Cleans the example Next.js application build outputs
rm -rf ${BUILD_FOLDER} || exit 0
mkdir -p ${BUILD_FOLDER}
example-install: check # Installs the dependencies for the example project
yarn --cwd example install
example-build: example-clean # Builds the example Next.js application
yarn --cwd example package
tag-release: check-version build-cloudfront-logs-lambda
git add .
git commit --allow-empty -m "Release ${version}"
git push
git tag ${version}
git push --tags
format-terraform: # Formats all Terraform Files
terraform fmt
terraform -chdir=modules/cloudfront-logs fmt
terraform -chdir=modules/opennext-assets fmt
terraform -chdir=modules/opennext-cloudfront fmt
terraform -chdir=modules/opennext-lambda fmt
terraform -chdir=modules/opennext-revalidation-queue fmt
terraform -chdir=example/terraform fmt