forked from plus3it/terraform-aws-org-new-account-iam-role
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (46 loc) · 2.19 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
SHELL := /bin/bash
export PYTHONPATH := $(PYTHONPATH):./lambda/src
include $(shell test -f .tardigrade-ci || curl -sSL -o .tardigrade-ci "https://raw.githubusercontent.com/plus3it/tardigrade-ci/master/bootstrap/Makefile.bootstrap"; echo .tardigrade-ci)
pytest/install:
@ $(MAKE) install/pip/$(@D) PYPI_PKG_NAME=$(@D)
@ python -m pip install \
-r lambda/tests/requirements_dev.txt \
-r tests/requirements_test.txt
.PHONY: python/deps
python/deps:
@ echo "[$@] Installing package dependencies"
@ python -m pip install -r lambda/src/requirements.txt
.PHONY: python/test
python/test: | guard/program/pytest
python/test:
@ echo "[$@] Starting Python tests"
pytest lambda/tests
@ echo "[$@]: Tests executed!"
.PHONY: terraform/pytest
terraform/pytest: | guard/program/terraform guard/program/pytest
@ echo "[$@] Starting test of Terraform lambda installation"
@ echo "[$@] LocalStack must be running; 'make localstack/up' can "
@ echo "[$@] be used to start LocalStack"
@ echo "[$@] Terraform 'apply' command is slow ... be patient !!!"
pytest tests
@ echo "[$@]: Completed successfully!"
.PHONY: localstack/pytest localstack/up localstack/down localstack/clean
localstack/pytest: | guard/program/terraform guard/program/pytest
@ echo "[$@] Running Terraform tests against LocalStack"
DOCKER_RUN_FLAGS="--network tests_default --rm -e LOCALSTACK_HOST=localstack" \
TARDIGRADE_CI_DOCKERFILE=Dockerfile_test \
IMAGE_NAME=new-account-iam-role-integration-test:latest \
$(MAKE) docker/run target=terraform/pytest
@ echo "[$@]: Completed successfully!"
localstack/up: | guard/program/terraform guard/program/pytest
@ echo "[$@] Starting LocalStack container"
docker-compose -f tests/docker-compose-localstack.yml up --detach
localstack/down: | guard/program/terraform guard/program/pytest
@ echo "[$@] Stopping LocalStack container"
docker-compose -f tests/docker-compose-localstack.yml down
localstack/clean: | localstack/down
@ echo "[$@] Stopping and removing LocalStack container and images"
set +o pipefail; docker images | grep lambci | \
awk '{print $$1 ":" $$2}' | xargs -r docker rmi
set +o pipefail; docker images | grep new-account-iam-role | \
awk '{print $$1 ":" $$2}' | xargs -r docker rmi