Skip to content

Commit

Permalink
Make GK lockfile updates strictly execute first in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
elenadimitrova committed Jul 11, 2018
1 parent 6674f0c commit 99849e1
Showing 1 changed file with 52 additions and 39 deletions.
91 changes: 52 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
version: 2

job_common: &job_common
docker:
- image: circleci/node:9.11.2
working_directory: ~/colonyNetwork
step_save_cache: &step_save_cache
save_cache:
paths:
- ~/.cache/yarn
key: node-modules-{{ checksum "yarn.lock" }}
step_restore_cache: &step_restore_cache
restore_cache:
keys:
- node-modules-{{ checksum "yarn.lock" }}
- node-modules-
step_setup_global_packages: &step_setup_global_packages
run:
name: "Set up global packages"
command: |
yarn --pure-lockfile
git submodule update --init
step_setup_greenkeeper: &step_setup_greenkeeper
run:
name: "Add greenkeeper-lockfile-update"
command: yarn global add greenkeeper-lockfile@1
jobs:
lint-and-unit-test:
docker:
- image: circleci/node:9.11.2
working_directory: ~/colonyNetwork
greenkeeper-updates:
<<: *job_common
steps:
- checkout
- restore_cache:
keys:
- node-modules-{{ checksum "yarn.lock" }}
- node-modules-
- <<: *step_restore_cache
- <<: *step_setup_global_packages
- <<: *step_setup_greenkeeper
- run:
name: "Set up global packages"
command: |
yarn global add greenkeeper-lockfile@1
yarn --pure-lockfile
git submodule update --init
name: "Run Greenkeeper lockfile update"
command: $(yarn global bin)/greenkeeper-lockfile-update
environment:
GK_LOCK_YARN_OPTS: "--ignore-workspace-root-check"
- <<: *step_save_cache
lint-and-unit-test:
<<: *job_common
steps:
- checkout
- <<: *step_restore_cache
- <<: *step_setup_global_packages
- <<: *step_setup_greenkeeper
- run:
name: "Setup parity"
command: |
Expand All @@ -28,20 +56,11 @@ jobs:
sed -i "s/xxxxx/$(parity --keys-path ./keys --password ./parityPassword account new)/g" ./parity-genesis.json
sed -i "s/yyyyy/$(parity --keys-path ./keys --password ./parityPassword account new)/g" ./parity-genesis.json
sed -i "s/zzzzz/$(parity --keys-path ./keys --password ./parityPassword account new)/g" ./parity-genesis.json
- save_cache:
paths:
- node_modules
key: node-modules-{{ checksum "yarn.lock" }}
- run:
name: "Install lsof"
command: |
sudo apt-get update
sudo apt-get install lsof
- run:
name: "Greenkeeper lockfile update"
command: $(yarn global bin)/greenkeeper-lockfile-update
environment:
GK_LOCK_YARN_OPTS: "--ignore-workspace-root-check"
- run:
name: "Linting JavaScript"
command: yarn run eslint
Expand All @@ -66,6 +85,7 @@ jobs:
- run:
name: "Running colony-contract-loader-network tests"
command: cd packages/colony-js-contract-loader-network && yarn run test
- <<: *step_save_cache
- run:
name: "Greenkeeper uploading lockfile"
command: $(yarn global bin)/greenkeeper-lockfile-upload
Expand All @@ -74,27 +94,15 @@ jobs:
path: test-results.xml
- store_artifacts:
path: test-results.xml

test-coverage:
docker:
- image: circleci/node:9.11.2
working_directory: ~/colonyNetwork
<<: *job_common
steps:
- checkout
- restore_cache:
keys:
- node-modules-{{ checksum "yarn.lock" }}
- node-modules-
- run:
name: "Set up global packages"
command: |
yarn global add greenkeeper-lockfile@1
yarn --pure-lockfile
git submodule update --init
- <<: *step_restore_cache
- <<: *step_setup_global_packages
- run:
name: "Running unit tests with coverage"
command: yarn run test:contracts:coverage

# Save coverage artifacts
- store_artifacts:
path: coverage
Expand All @@ -103,5 +111,10 @@ workflows:
version: 2
commit:
jobs:
- lint-and-unit-test
- test-coverage
- greenkeeper-updates
- lint-and-unit-test:
requires:
- greenkeeper-updates
- test-coverage:
requires:
- greenkeeper-updates

0 comments on commit 99849e1

Please sign in to comment.