@@ -3,73 +3,89 @@ version: 2
3
3
jobs :
4
4
build-dependencies :
5
5
docker :
6
- - image : circleci/node:9.2.1
6
+ - image : circleci/node:10
7
7
working_directory : ~/codesandbox-client
8
8
steps :
9
9
- checkout
10
10
- restore_cache :
11
11
keys :
12
- - v3-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13
- - v3-dependency-cache-{{ .Branch }}
14
- - v3-dependency-cache
12
+ - v14-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13
+ - v14-dependency-cache-{{ .Branch }}
14
+ - v14-dependency-cache
15
+ - restore_cache :
16
+ keys :
17
+ - v14-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18
+ - v14-standalone-dependency-cache-{{ .Branch }}
19
+ - v14-standalone-dependency-cache
15
20
- run :
16
21
name : Install Dependencies
17
22
command : yarn install
18
23
- save_cache :
19
- key : v3 -dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
24
+ key : v14 -dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
20
25
paths :
21
26
- node_modules
27
+ - packages/app/node_modules
28
+ - packages/codesandbox-api/node_modules
29
+ - packages/common/node_modules
30
+ - packages/homepage/node_modules
31
+ - packages/react-sandpack/node_modules
32
+ - packages/sandpack/node_modules
33
+ - save_cache :
34
+ key : v14-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
35
+ paths :
36
+ - standalone-packages/codesandbox-browserfs/node_modules
22
37
- run :
23
38
name : Build
24
- command : yarn build:dependents
39
+ command : yarn build:deps
25
40
- save_cache :
26
- key : v3 -repo-{{ .Environment.CIRCLE_SHA1 }}
41
+ key : v14 -repo-{{ .Environment.CIRCLE_SHA1 }}
27
42
paths :
28
43
- ~/codesandbox-client
29
44
30
45
build-prod :
31
46
docker :
32
- - image : circleci/node:9.2.1
47
+ - image : circleci/node:10
33
48
working_directory : ~/codesandbox-client
34
49
steps :
35
50
- restore_cache :
36
- key : v3 -repo-{{ .Environment.CIRCLE_SHA1 }}
51
+ key : v14 -repo-{{ .Environment.CIRCLE_SHA1 }}
37
52
# We do this to compare sizes from these builds with master
38
53
- restore_cache :
39
- key : v3 -prod-app-build-cache-master
54
+ key : v14 -prod-app-build-cache-master
40
55
- run :
41
56
name : Build Application
42
57
command : yarn build:prod
43
58
- save_cache :
44
- key : v3 -prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
59
+ key : v14 -prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
45
60
paths :
46
61
- ./packages/app/www
47
62
- save_cache :
48
- key : v3 -prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
63
+ key : v14 -prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
49
64
paths :
50
65
- ./www
51
- - store_artifacts :
52
- path : ./www
53
- destination : www
54
66
55
67
test-integrations :
56
68
docker :
57
69
- image : codesandbox/node-puppeteer
58
70
working_directory : ~/codesandbox-client
59
71
steps :
60
72
- restore_cache :
61
- key : v3 -repo-{{ .Environment.CIRCLE_SHA1 }}
73
+ key : v14 -repo-{{ .Environment.CIRCLE_SHA1 }}
62
74
- run :
63
75
name : Start Test Server
64
76
command : yarn start:test
65
77
background : true
78
+ - run :
79
+ name : Setup BrowserStack local environment
80
+ command : ' [ -n "$BROWSER_STACK_KEY" ] && ./packages/app/integration-tests/BrowserStackLocal --key $BROWSER_STACK_KEY || true'
81
+ background : true
66
82
- run :
67
83
name : Test Integrations
68
84
command : |
69
- sleep 6
85
+ sleep 15
70
86
yarn test:integrations --ci --testResultsProcessor="jest-junit"
71
87
environment :
72
- JEST_JUNIT_OUTPUT : " /tmp/test-results/js-test-results.xml"
88
+ JEST_JUNIT_OUTPUT : ' /tmp/test-results/js-test-results.xml'
73
89
- store_test_results :
74
90
path : /tmp/test-results
75
91
- store_artifacts :
@@ -78,45 +94,44 @@ jobs:
78
94
79
95
test-jest :
80
96
docker :
81
- - image : circleci/node:9.2.1
97
+ - image : circleci/node:10
82
98
working_directory : ~/codesandbox-client
83
99
steps :
84
100
- restore_cache :
85
- key : v3 -repo-{{ .Environment.CIRCLE_SHA1 }}
101
+ key : v14 -repo-{{ .Environment.CIRCLE_SHA1 }}
86
102
- run :
87
103
name : Test
88
104
command : yarn test --ci --testResultsProcessor="jest-junit"
89
105
environment :
90
- JEST_JUNIT_OUTPUT : " reports/junit/js-test-results.xml"
106
+ JEST_JUNIT_OUTPUT : ' reports/junit/js-test-results.xml'
91
107
92
108
lint :
93
109
docker :
94
- - image : circleci/node:9.2.1
110
+ - image : circleci/node:10
95
111
working_directory : ~/codesandbox-client
96
112
steps :
97
113
- restore_cache :
98
- key : v3 -repo-{{ .Environment.CIRCLE_SHA1 }}
114
+ key : v14 -repo-{{ .Environment.CIRCLE_SHA1 }}
99
115
- run :
100
116
name : Lint
101
117
command : yarn lint
102
118
103
- deploy :
104
- docker :
105
- - image : circleci/node:9.2.1
119
+ create-docker-image :
120
+ machine : true
106
121
working_directory : ~/codesandbox-client
107
122
steps :
123
+ - checkout
108
124
- restore_cache :
109
- key : v3-repo-{{ .Environment.CIRCLE_SHA1 }}
110
- - restore_cache :
111
- key : v3-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
112
- - add_ssh_keys :
113
- fingerprints :
114
- - " f7:f1:e6:60:96:24:d9:cd:1b:8b:c0:34:e7:ee:fa:82"
125
+ key : v14-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
115
126
- run :
116
- name : Add key to known_hosts
117
- command : echo "ssh.codesandbox.io ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKyKbuMPJSETTyPRRJVOeC5I8j7wyUMW8HYheg7cN71eKTuw55tkoygxI59BvNi/CAyCnRT5LnxZhvrq9nSlPYc=" >> ~/.ssh/known_hosts
127
+ name : Docker Sign In
128
+ command : ' [ -n "$DOCKER_USER" ] && echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin || true'
129
+ - run :
130
+ name : Create Image
131
+ command : ' [ -n "$DOCKER_USER" ] && docker build -t codesandbox/client:${CIRCLE_SHA1:0:7} . || true'
118
132
- deploy :
119
- command : sh ./deploy.sh
133
+ name : Push Image
134
+ command : ' [ -n "$DOCKER_USER" ] && docker push codesandbox/client:${CIRCLE_SHA1:0:7} || true'
120
135
121
136
workflows :
122
137
version : 2
@@ -135,19 +150,9 @@ workflows:
135
150
- build-prod :
136
151
requires :
137
152
- build-dependencies
138
- - hold :
139
- type : approval
140
- filters :
141
- branches :
142
- only : master
153
+ - create-docker-image :
143
154
requires :
144
155
- build-prod
145
156
- lint
146
- - test-integrations
157
+ # - test-integrations
147
158
- test-jest
148
- - deploy :
149
- filters :
150
- branches :
151
- only : master
152
- requires :
153
- - hold
0 commit comments