-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfig.yml
162 lines (157 loc) · 4.68 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
version: 2
jobs:
checkout_and_compile:
docker:
- image: circleci/node:12.16.0
environment:
NODE_OPTIONS: --max_old_space_size=8192
resource_class: large
working_directory: ~/set-v2-strategies
steps:
- checkout
- restore_cache:
key: module-cache-{{ checksum "yarn.lock" }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- run:
name: Fetch Dependencies
command: yarn install
- save_cache:
key: module-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: Transpile Contracts
command: yarn build
- save_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/set-v2-strategies
test:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-v2-strategies
parallelism: 3
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- run:
name: Test RPC
command: yarn chain
background: true
- run:
name: Hardhat Test
command: |
TEST_FILES="$(circleci tests glob "./test/**/*.spec.ts" | circleci tests split)"
yarn test ${TEST_FILES}
test_forked_network:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-v2-strategies
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- run:
name: Create shared coverage outputs folder
command: mkdir -p /tmp/forked_coverage
- run:
name: Hardhat Test
command: yarn test:fork:coverage
- run:
name: Save coverage
command: |
cp coverage.json /tmp/forked_coverage/forked_cov.json
chmod -R 777 /tmp/forked_coverage/forked_cov.json
- persist_to_workspace:
root: /tmp/forked_coverage
paths:
- forked_cov.json
coverage:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-v2-strategies
# When changing the parallelism value, you also
# need to update the `persist_to_workspace` paths
# in this job (below) as well as the list of files passed
# to istanbul-combine in the `report_coverage` job
parallelism: 5
steps:
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set Up Environment Variables
command: cp .env.default .env
- run:
name: Create shared coverage outputs folder
command: mkdir -p /tmp/coverage
- run:
name: Coverage
command: |
TEST_FILES="{$(circleci tests glob "./test/**/*.spec.ts" | \
circleci tests split | xargs | sed -e 's/ /,/g')}"
yarn coverage -- --testfiles "$TEST_FILES"
- run:
name: Save coverage
command: |
cp coverage.json /tmp/coverage/cov_$CIRCLE_NODE_INDEX.json
chmod -R 777 /tmp/coverage/cov_$CIRCLE_NODE_INDEX.json
- persist_to_workspace:
root: /tmp/coverage
paths:
- cov_0.json
- cov_1.json
- cov_2.json
- cov_3.json
- cov_4.json
report_coverage:
docker:
- image: circleci/node:12.16.0
working_directory: ~/set-v2-strategies
steps:
- attach_workspace:
at: /tmp/coverage
- attach_workspace:
at: /tmp/forked_coverage
- restore_cache:
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Combine coverage reports
command: |
cp -R /tmp/coverage/* .
cp -R /tmp/forked_coverage/* .
npx istanbul-combine-updated -r lcov \
cov_0.json \
cov_1.json \
cov_2.json \
cov_3.json \
cov_4.json \
forked_cov.json
- run:
name: Upload coverage
command: |
cat coverage/lcov.info | node_modules/.bin/coveralls
workflows:
version: 2
build-and-test:
jobs:
- checkout_and_compile
- test:
requires:
- checkout_and_compile
- test_forked_network:
requires:
- checkout_and_compile
- coverage:
requires:
- checkout_and_compile
- report_coverage:
requires:
- coverage
- test_forked_network