-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
126 lines (117 loc) · 4.61 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
travis:
@if [ "$$SUITE" = "2017" ]; then \
echo "\n--- Budget Tests\n"; \
cd packages/budget && yarn test && cd -; \
\
echo "\n--- Emergency Response Tests\n"; \
cd packages/emergency-response && yarn test && cd -; \
\
echo "\n--- Homelessness Tests\n"; \
cd packages/homelessness && yarn test && cd -; \
\
echo "\n--- Housing Tests\n"; \
cd packages/housing && yarn test && cd -; \
\
echo "\n--- Transportation Tests\n"; \
cd packages/transportation && yarn test && cd -; \
\
echo "\n--- 2017 Tests\n"; \
cd packages/2017 && yarn test && cd -; \
\
echo "\n--- Build 2017\n"; \
cd packages/2017 && yarn build --bail && cd -; \
fi
@if [ "$$SUITE" = "2018" ]; then \
echo "\n--- Disaster Tests\n"; \
cd packages/2018-disaster-resilience && yarn test && cd -; \
\
echo "\n--- Housing Tests\n"; \
cd packages/2018-housing-affordability && yarn test && cd -; \
\
echo "\n--- Elections Tests\n"; \
cd packages/2018-local-elections && yarn test && cd -; \
\
echo "\n--- Neighborhood Tests\n"; \
cd packages/2018-neighborhood-development && yarn test && cd -; \
\
echo "\n--- Transportation Tests\n"; \
cd packages/2018-transportation-systems && yarn test && cd -; \
\
echo "\n--- Example Farmers Markets\n"; \
cd packages/2018-example-farmers-markets && yarn test && cd -; \
\
echo "\n--- Civic Sandbox Tests\n"; \
cd packages/civic-sandbox && yarn test && cd -; \
\
echo "\n--- 2018 Tests\n"; \
cd packages/2018 && yarn test && cd -; \
\
echo "\n--- Build 2018\n"; \
cd packages/2018 && yarn build --bail && cd -; \
fi
@if [ "$$SUITE" = "COMPONENT_LIBRARY" ]; then \
cd packages/component-library && yarn test && cd -; \
fi
@if [ "$$SUITE" = "2019_DISASTER_GAME" ]; then \
cd packages/2019-disaster-game && yarn test && cd -; \
fi
deploy:
@if [ -z "$$TRAVIS_PULL_REQUEST" ] || [ "$$TRAVIS_PULL_REQUEST" = "false" ]; then \
if [ "$$TRAVIS_BRANCH" = "master" ]; then \
if [ "$$SUITE" = "2017" ]; then \
make deploy-2017; \
fi; \
if [ "$$SUITE" = "2018" ]; then \
make deploy-2018; \
fi; \
if [ "$$SUITE" = "COMPONENT_LIBRARY" ]; then \
make deploy-component-library; \
fi; \
if [ "$$SUITE" = "2019_DISASTER_GAME" ]; then \
make deploy-2019-disaster-game; \
fi \
else \
echo "No deploys on branches other than 'master'"; \
fi \
else \
echo "No deploys on PRs"; \
fi
setup-aws:
@echo "Setting up AWS access"
pip install --user awscli
export PATH=$$PATH:$$HOME/.local/bin
access-ecr:
@echo "Accessing ECR"
eval $$(aws ecr get-login --no-include-email --region $$AWS_DEFAULT_REGION)
deploy-2017: setup-aws access-ecr
@echo "Deploying the 2017 Container"
cd packages/2017 && yarn run build
cd packages/2017 && docker build -t civic-2017 .
@echo "Pushing civic-2017:latest"
cd packages/2017 && docker tag civic-2017:latest "$$REMOTE_IMAGE_URL/civic-2017:latest"
cd packages/2017 && docker push "$$REMOTE_IMAGE_URL/civic-2017:latest"
@echo "Pushed civic-2017:latest"
@echo "Deploying latest for $$ECS_SERVICE_2017"
./bin/ecs-deploy.sh --cluster $$ECS_CLUSTER --service-name $$ECS_SERVICE_2017 --image $$REMOTE_IMAGE_URL/civic-2017:latest --timeout 10
deploy-2018: setup-aws access-ecr
@echo "Deploying the 2018 Container"
cd packages/2018 && yarn run build
cd packages/2018 && docker build -t civic-2018 .
@echo "Pushing civic-2018:latest"
cd packages/2018 && docker tag civic-2018:latest "$$REMOTE_IMAGE_URL/civic-2018:latest"
cd packages/2018 && docker push "$$REMOTE_IMAGE_URL/civic-2018:latest"
@echo "Pushed civic-2018:latest"
@echo "Deploying latest for $$ECS_SERVICE_2018"
docker push $$REMOTE_IMAGE_URL/civic-2018:latest
./bin/ecs-deploy.sh --cluster $$ECS_CLUSTER --service-name $$ECS_SERVICE_2018 --image $$REMOTE_IMAGE_URL/civic-2018:latest --timeout 10
deploy-2019-disaster-game: setup-aws access-ecr
@echo "Deploying the 2019-disaster-game Container"
cd packages/2019-disaster-game && yarn run build
cd packages/2019-disaster-game && docker build --build-arg SENTRYDSN=$$SENTRYDSN -t civic-2019-disaster-game .
@echo "Pushing civic-2019-disaster-game:latest"
cd packages/2019-disaster-game && docker tag civic-2019-disaster-game:latest "$$REMOTE_IMAGE_URL/civic-2019-disaster-game:latest"
cd packages/2019-disaster-game && docker push "$$REMOTE_IMAGE_URL/civic-2019-disaster-game:latest"
@echo "Pushed civic-2019-disaster-game:latest"
@echo "Deploying latest for $$ECS_SERVICE_2019_DISASTER_GAME"
docker push $$REMOTE_IMAGE_URL/civic-2019-disaster-game:latest
./bin/ecs-deploy.sh --cluster $$ECS_CLUSTER --service-name $$ECS_SERVICE_2019_DISASTER_GAME --image $$REMOTE_IMAGE_URL/civic-2019-disaster-game:latest --timeout 10