-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
168 lines (149 loc) · 4.39 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
version: 2
.job-defaults: &job-defaults
docker:
- image: circleci/node:12.10-stretch-browsers
.store-cache-npm-deps: &store-cache-npm-deps
save_cache:
key: npm-deps-{{ checksum "yarn.lock" }}
paths: [ node_modules, ~/.cache/Cypress/ ]
.restore-cache-npm-deps: &restore-cache-npm-deps
restore_cache:
key: npm-deps-{{ checksum "yarn.lock" }}
.attach-workspace: &attach-workspace
attach_workspace:
at: .
.run-install: &run-install
run:
name: Installing
command: yarn install --frozen-lockfile
.cypress-artifacts: &cypress-artifacts
store_artifacts: { path: dist/cypress, destination: dist/cypress }
jobs:
build:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *run-install
- *store-cache-npm-deps
- run:
name: Build
command: |
source tools/ci-get-set-env.sh
yarn build:$APP_ENV_NAME --progress=false
yarn analyze
- persist_to_workspace:
root: .
paths:
- dist/apps/*
- store_artifacts: { path: dist/apps, destination: dist/apps }
unit-tests:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *run-install
- run: yarn test:ci --progress=false
- persist_to_workspace:
root: .
paths: [ coverage/* ]
- store_test_results:
path: coverage/apps/wcn/clover.xml
linting:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *run-install
- run: yarn lint
e2e-tests:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *attach-workspace
- *run-install
- run: |
yarn serve &
yarn e2e:ci --base-url=http://localhost:4104
- *cypress-artifacts
e2e-smoke-dev:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *attach-workspace
- *run-install
- run: |
yarn e2e:ci --base-url=https://stage.what-conference-next.com
- *cypress-artifacts
e2e-smoke-prod:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *attach-workspace
- *run-install
- run: |
yarn e2e:ci --base-url=https://what-conference-next.com
- *cypress-artifacts
deploy:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *attach-workspace
- *run-install
- run:
name: Deploy STAGE
command: |
yarn deploy
# Send deploy message to #frontend-events-dev Slack channel
curl -X POST --data-urlencode "payload={\"channel\": \"#frontend-events-dev\", \"username\": \"CI Deployments\", \"text\": \"*STAGE https://stage.what-conference-next.com/ deployed with success* :green_heart:\", \"icon_emoji\": \":rocket:\"}" https://hooks.slack.com/services/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
deploy-prod:
<<: *job-defaults
steps:
- checkout
- *restore-cache-npm-deps
- *attach-workspace
- *run-install
- run:
name: Deploy PROD
command: |
yarn deploy:prod
# Send deploy message to #frontend-events-dev Slack channel
curl -X POST --data-urlencode "payload={\"channel\": \"#frontend-events-dev\", \"username\": \"CI Deployments\", \"text\": \"*LIVE https://what-conference-next.com deployed with success* :green_heart:\", \"icon_emoji\": \":bomb:\"}" https://hooks.slack.com/services/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
#
# Workflow setup
#
workflows:
version: 2
build test deploy:
jobs:
- build
- unit-tests:
requires: [ build ]
- linting:
requires: [ build ]
- e2e-tests:
requires: [ build ]
# TODO: we need to fine-tune Cypress so it can run on production DB
# Since it's the same job as on dev/stage, we cannot apply here wcn-prod context
filters:
branches:
ignore: prod
- deploy:
requires: [ unit-tests, e2e-tests ]
filters:
branches:
only: master
- e2e-smoke-dev:
requires: [ deploy ]
- deploy-prod:
requires: [ unit-tests ]
filters:
branches:
only: prod
- e2e-smoke-prod:
requires: [ deploy-prod ]
context: wcn-prod