ci: improve caching
Steven Allen committed
Jul 9, 2019 at 21:02 UTC
cf76b0d72ceb86452285c4e2b8f43f245aa226d3
1 file changed
+37
-6
.circleci/config.yml
+37
-6
@@ -150,11 +150,19 @@ jobs:
150
- attach_workspace:
151
at: /tmp/circleci-workspace
152
- run: git clone https://github.com/ipfs/interop.git
153
+ - restore_cache:
154
+ keys:
155
+ - v1-interop-{{ checksum "~/ipfs/go-ipfs/interop/package-lock.json" }}
156
+ - v1-interop-
157
- run:
158
command: npm install
159
working_directory: ~/ipfs/go-ipfs/interop
160
environment:
161
IPFS_GO_EXEC: /tmp/circleci-workspace/bin/ipfs
162
+ - save_cache:
163
+ key: v1-interop-{{ checksum "~/ipfs/go-ipfs/interop/package-lock.json" }}
164
+ paths:
165
+ - ~/ipfs/go-ipfs/interop/node_modules
166
- run:
167
command: npm test
168
working_directory: ~/ipfs/go-ipfs/interop
@@ -168,9 +176,11 @@ jobs:
176
- *make_out_dirs
177
- attach_workspace:
178
at: /tmp/circleci-workspace
171
- - run: git clone https://github.com/ipfs/go-ipfs-api.git
179
- run:
173
- name: IPFS Daemon
180
+ name: Cloning
181
+ command: git clone https://github.com/ipfs/go-ipfs-api.git
182
+ - run:
183
+ name: Starting the daemon
184
command: /tmp/circleci-workspace/bin/ipfs daemon --init --enable-namesys-pubsub
185
background: true
186
- run:
@@ -180,9 +190,21 @@ jobs:
190
while ! /tmp/circleci-workspace/bin/ipfs id --api=/ip4/127.0.0.1/tcp/5001 2>/dev/null; do
191
sleep 1
192
done
193
+ - restore_cache:
194
+ keys:
195
+ - v1-go-api-{{ checksum "~/ipfs/go-ipfs/go-ipfs-api/go.sum" }}
196
+ - v1-go-api-
197
- run:
198
command: go test -v ./...
199
working_directory: ~/ipfs/go-ipfs/go-ipfs-api
200
+ - save_cache:
201
+ key: v1-go-api-{{ checksum "~/ipfs/go-ipfs/go-ipfs-api/go.sum" }}
202
+ paths:
203
+ - ~/go/pkg/mod
204
+ - ~/.cache/go-build/
205
+ - run:
206
+ name: Stopping the daemon
207
+ command: /tmp/circleci-workspace/bin/ipfs shutdown
208
go-ipfs-http-client:
209
docker:
210
- image: circleci/golang:1.12
@@ -191,15 +213,24 @@ jobs:
213
- *make_out_dirs
214
- attach_workspace:
215
at: /tmp/circleci-workspace
194
- - run: git clone https://github.com/ipfs/go-ipfs-http-client.git
216
- run:
217
+ name: Cloning
218
+ command: git clone https://github.com/ipfs/go-ipfs-http-client.git
219
+ - restore_cache:
220
+ keys:
221
+ - v1-http-client-{{ checksum "~/ipfs/go-ipfs/go-ipfs-http-client/go.sum" }}
222
+ - v1-http-client-
223
+ - run:
224
+ name: go test -v ./...
225
command: |
226
export PATH=/tmp/circleci-workspace/bin:$PATH
227
go test -v ./...
228
working_directory: ~/ipfs/go-ipfs/go-ipfs-http-client
200
- - run:
201
- command: /tmp/circleci-workspace/bin/ipfs shutdown
202
-
229
+ - save_cache:
230
+ key: v1-http-client-{{ checksum "~/ipfs/go-ipfs/go-ipfs-http-client/go.sum" }}
231
+ paths:
232
+ - ~/go/pkg/mod
233
+ - ~/.cache/go-build/
234
workflows:
235
version: 2
236
test: