-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.yml
194 lines (188 loc) · 7.03 KB
/
config.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# https://circleci.com/docs/2.0/language-javascript/
version: 2.1
jobs:
build:
docker:
- image: cimg/node:14.18.0
parallelism: 3
resource_class: large
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- save_cache:
paths:
- ~/.cache/yarn
- node_modules
key: v2-dependencies-{{ checksum "yarn.lock" }}
- run: yarn compile
- run:
name: Webpack build
command: yarn build:local
no_output_timeout: 5m
lint:
docker:
- image: cimg/node:14.18.0
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- save_cache:
paths:
- ~/.cache/yarn
- node_modules
key: v2-dependencies-{{ checksum "yarn.lock" }}
- run: yarn lint
test:
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
# feature, as documented in https://circleci.com/docs/2.0/building-docker-images/#separation-of-environments
# As a consequence, we cannot use the circleci CLI for this job because "You cannot use the machine
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
#
# Available images: https://circleci.com/developer/machine/image/ubuntu-2004
image: ubuntu-2004:2022.07.1
steps:
- checkout
- run: # start early for less wait time below
name: Start tgrade and faucet
command: |
./scripts/start_all_ci.sh
background: true
- run:
# The images comes with preinstalled nvm, which does not work well with non-login shells
name: Uninstall nvm
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
command: |
nvm --version && nvm ls
mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
- run:
name: Install nodejs
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_14.x/pool/main/n/nodejs/nodejs_14.18.0-deb-1nodesource1_amd64.deb
sudo dpkg -i "$HOME/nodejs.deb"
- run:
name: Install yarn
# without `sudo apt update` which is too slow
command: |
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.15_all.deb
sudo dpkg -i "$HOME/yarn.deb"
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- v2-dependencies-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
# - run: yarn build
- save_cache:
name: Save Yarn Package Cache
key: v2-dependencies-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- node_modules
- run:
name: Wait for chains to start up
command: |
timeout 60 bash -c "until curl -s http://localhost:8000/status > /dev/null; do sleep 0.5; done"
- run:
name: Deploy contracts
command: |
cd ./scripts/tgrade/
./init.sh
- run:
command: yarn craco test
- run:
name: Stop chains
command: |
./scripts/stop_all.sh
cy-local:
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
# feature, as documented in https://circleci.com/docs/2.0/building-docker-images/#separation-of-environments
# As a consequence, we cannot use the circleci CLI for this job because "You cannot use the machine
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
#
# Available images: https://circleci.com/developer/machine/image/ubuntu-2004
image: ubuntu-2004:2022.07.1
steps:
- checkout
- run:
name: Upgrade max watchable files to avoid ENOSPC
command: sudo sysctl -w fs.inotify.max_user_watches=524288
- run: # start early for less wait time below
name: Start tgrade and faucet
command: |
./scripts/start_all_ci.sh
background: true
- run:
# The images comes with preinstalled nvm, which does not work well with non-login shells
name: Uninstall nvm
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
command: |
nvm --version && nvm ls
mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
- run:
name: Install nodejs
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_14.x/pool/main/n/nodejs/nodejs_14.18.0-deb-1nodesource1_amd64.deb
sudo dpkg -i "$HOME/nodejs.deb"
- run:
name: Install yarn
# without `sudo apt update` which is too slow
command: |
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.15_all.deb
sudo dpkg -i "$HOME/yarn.deb"
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- run: yarn cypress install
- save_cache:
name: Save Yarn Package Cache
key: v1-dependencies-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- node_modules
- run:
name: Wait for chains to start up
command: |
timeout 60 bash -c "until curl -s http://localhost:8000/status > /dev/null; do sleep 0.5; done"
- run:
name: Deploy contracts
command: |
cd ./scripts/tgrade/
./init.sh
- run:
command: yarn cy:local
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots
- run:
name: Stop chains
command: |
./scripts/stop_all.sh
workflows:
build_and_test:
jobs:
- lint
- cy-local
- test
- build:
requires:
- lint
- test