This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
forked from noslouch/clicktocongress-node
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcircle.yml
101 lines (97 loc) · 2.65 KB
/
circle.yml
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
---
version: 2
jobs:
test:
working_directory: ~/click-to-congress
docker:
- image: cimg/node:14.21.2
steps:
- checkout
- restore_cache:
key: npm-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- run:
name: Install Requirements
command: |
if [[ ! -d ~/click-to-congress/node_modules ]]; then
npm install
npm install mocha
fi
- run:
name: Test
command: |
npm test
- save_cache:
key: npm-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- ~/click-to-congress/node_modules
deploy:
working_directory: ~/click-to-congress
docker:
- image: circleci/python:3.6
steps:
- checkout
- setup_remote_docker
- restore_cache:
key: deploy-{{ checksum "circle.yml" }}
- run:
name: Install Requirements
command: |
if [[ ! -d ~/.venv ]]; then
python3 -m venv ~/.venv
source ~/.venv/bin/activate
pip3 install -U git+https://github.com/nypublicradio/nyprsetuptools.git
fi
- deploy:
command: |
source ~/.venv/bin/activate
if [[ "${CIRCLE_BRANCH}" == "master" ]]; then
ENV="demo"
TAG="demo"
elif echo "$CIRCLE_TAG" | grep -q "v[0-9]\+\.[0-9]\+\.[0-9]\+"; then
ENV="prod"
TAG="$CIRCLE_TAG"
else
exit 1
fi
nyprsetuptools DockerDeploy \
--cpu=256 \
--ecr-repository=click-to-congress \
--ecs-cluster=microservices \
--environment=$ENV \
--execution-role="ecsTaskExecutionRole" \
--fargate \
--memory-reservation=512 \
--ports=3000 \
--task-role=click-to-congress-$ENV \
--tag="$TAG" \
--test='npm test' \
--wait=300
- save_cache:
key: deploy-{{ checksum "circle.yml" }}
paths:
- ~/.venv
- ~/click-to-congress/.eggs
workflows:
version: 2
test-n-deploy:
jobs:
- test:
filters:
tags:
only: /.*/
branches:
only: /.*/
- deploy:
requires:
- test
context: "AWS Deploy"
filters:
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+/
branches:
only: master
experimental:
notify:
branches:
only:
- master