Skip to content

Commit cb59bc6

Browse files
Merge pull request #275 from JoinColony/maintenance/greenkeeper-ci-config
Make GreenKeeper lockfile updates strictly execute first in CI
2 parents 6674f0c + 99849e1 commit cb59bc6

File tree

1 file changed

+52
-39
lines changed

1 file changed

+52
-39
lines changed

.circleci/config.yml

Lines changed: 52 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
11
version: 2
22

3+
job_common: &job_common
4+
docker:
5+
- image: circleci/node:9.11.2
6+
working_directory: ~/colonyNetwork
7+
step_save_cache: &step_save_cache
8+
save_cache:
9+
paths:
10+
- ~/.cache/yarn
11+
key: node-modules-{{ checksum "yarn.lock" }}
12+
step_restore_cache: &step_restore_cache
13+
restore_cache:
14+
keys:
15+
- node-modules-{{ checksum "yarn.lock" }}
16+
- node-modules-
17+
step_setup_global_packages: &step_setup_global_packages
18+
run:
19+
name: "Set up global packages"
20+
command: |
21+
yarn --pure-lockfile
22+
git submodule update --init
23+
step_setup_greenkeeper: &step_setup_greenkeeper
24+
run:
25+
name: "Add greenkeeper-lockfile-update"
26+
command: yarn global add greenkeeper-lockfile@1
327
jobs:
4-
lint-and-unit-test:
5-
docker:
6-
- image: circleci/node:9.11.2
7-
working_directory: ~/colonyNetwork
28+
greenkeeper-updates:
29+
<<: *job_common
830
steps:
931
- checkout
10-
- restore_cache:
11-
keys:
12-
- node-modules-{{ checksum "yarn.lock" }}
13-
- node-modules-
32+
- <<: *step_restore_cache
33+
- <<: *step_setup_global_packages
34+
- <<: *step_setup_greenkeeper
1435
- run:
15-
name: "Set up global packages"
16-
command: |
17-
yarn global add greenkeeper-lockfile@1
18-
yarn --pure-lockfile
19-
git submodule update --init
36+
name: "Run Greenkeeper lockfile update"
37+
command: $(yarn global bin)/greenkeeper-lockfile-update
38+
environment:
39+
GK_LOCK_YARN_OPTS: "--ignore-workspace-root-check"
40+
- <<: *step_save_cache
41+
lint-and-unit-test:
42+
<<: *job_common
43+
steps:
44+
- checkout
45+
- <<: *step_restore_cache
46+
- <<: *step_setup_global_packages
47+
- <<: *step_setup_greenkeeper
2048
- run:
2149
name: "Setup parity"
2250
command: |
@@ -28,20 +56,11 @@ jobs:
2856
sed -i "s/xxxxx/$(parity --keys-path ./keys --password ./parityPassword account new)/g" ./parity-genesis.json
2957
sed -i "s/yyyyy/$(parity --keys-path ./keys --password ./parityPassword account new)/g" ./parity-genesis.json
3058
sed -i "s/zzzzz/$(parity --keys-path ./keys --password ./parityPassword account new)/g" ./parity-genesis.json
31-
- save_cache:
32-
paths:
33-
- node_modules
34-
key: node-modules-{{ checksum "yarn.lock" }}
3559
- run:
3660
name: "Install lsof"
3761
command: |
3862
sudo apt-get update
3963
sudo apt-get install lsof
40-
- run:
41-
name: "Greenkeeper lockfile update"
42-
command: $(yarn global bin)/greenkeeper-lockfile-update
43-
environment:
44-
GK_LOCK_YARN_OPTS: "--ignore-workspace-root-check"
4564
- run:
4665
name: "Linting JavaScript"
4766
command: yarn run eslint
@@ -66,6 +85,7 @@ jobs:
6685
- run:
6786
name: "Running colony-contract-loader-network tests"
6887
command: cd packages/colony-js-contract-loader-network && yarn run test
88+
- <<: *step_save_cache
6989
- run:
7090
name: "Greenkeeper uploading lockfile"
7191
command: $(yarn global bin)/greenkeeper-lockfile-upload
@@ -74,27 +94,15 @@ jobs:
7494
path: test-results.xml
7595
- store_artifacts:
7696
path: test-results.xml
77-
7897
test-coverage:
79-
docker:
80-
- image: circleci/node:9.11.2
81-
working_directory: ~/colonyNetwork
98+
<<: *job_common
8299
steps:
83100
- checkout
84-
- restore_cache:
85-
keys:
86-
- node-modules-{{ checksum "yarn.lock" }}
87-
- node-modules-
88-
- run:
89-
name: "Set up global packages"
90-
command: |
91-
yarn global add greenkeeper-lockfile@1
92-
yarn --pure-lockfile
93-
git submodule update --init
101+
- <<: *step_restore_cache
102+
- <<: *step_setup_global_packages
94103
- run:
95104
name: "Running unit tests with coverage"
96105
command: yarn run test:contracts:coverage
97-
98106
# Save coverage artifacts
99107
- store_artifacts:
100108
path: coverage
@@ -103,5 +111,10 @@ workflows:
103111
version: 2
104112
commit:
105113
jobs:
106-
- lint-and-unit-test
107-
- test-coverage
114+
- greenkeeper-updates
115+
- lint-and-unit-test:
116+
requires:
117+
- greenkeeper-updates
118+
- test-coverage:
119+
requires:
120+
- greenkeeper-updates

0 commit comments

Comments
 (0)