From 2f67f13bf8d7b5fcb2bb428611712a86852d9673 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Fri, 7 Dec 2018 00:20:19 +0100 Subject: [PATCH 1/6] Migrate CI config to circleci v2 --- .circleci/config.yml | 40 ++++++++++++++++++++++++++++++++++++++++ circle.yml | 23 ----------------------- 2 files changed, 40 insertions(+), 23 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..360d6603e5 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,40 @@ +version: 2.1 +executors: + node-11: + docker: + - image: circleci/node:10 +jobs: + build: + executor: node-11 + steps: + - checkout + - restore_cache: + keys: + # when lock file changes, we still use increasingly general patterns to restore cache + # the install afterwards will only install packages with different versions + - yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-cache-{{ .Branch }}- + - run: + name: Install dependencies + command: | + yarn --version + yarn install --frozen-lockfile + cd example + yarn install --frozen-lockfile + - save_cache: + key: yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} + paths: + - ~/.yarn + - ~/.cache/yarn + - ./node_modules + - ./example/node_modules + - run: + name: Test Library + command: | + yarn test:ci + - run: + name: Test Example App + command: | + cd example + yarn test:ci + yarn test:coverage diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 2fad34f39d..0000000000 --- a/circle.yml +++ /dev/null @@ -1,23 +0,0 @@ -machine: - environment: - YARN_VERSION: 1.3.2 - PATH: "${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin" - node: - version: 8.9.3 -dependencies: - pre: - - | - if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION - fi - - cache_directories: - - ~/.yarn - - ~/.cache/yarn - override: - - yarn install --no-progress - - cd example && yarn install --no-progress -test: - override: - - yarn run test:ci - - cd example && yarn run test:ci && yarn run test:coverage From 0c1f38610690b0496301085deccaf24eb8163de9 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Fri, 7 Dec 2018 01:31:52 +0100 Subject: [PATCH 2/6] Split circleci config into 3 jobs, add workflow --- .circleci/config.yml | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 360d6603e5..f51407e1b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,16 +1,17 @@ +# Note: all paths are relative to the default workspace ~/project version: 2.1 executors: node-11: docker: - image: circleci/node:10 jobs: - build: + install-dependencies: executor: node-11 steps: - checkout - restore_cache: keys: - # when lock file changes, we still use increasingly general patterns to restore cache + # if lock file changes, we still use increasingly general patterns to restore cache # the install afterwards will only install packages with different versions - yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} - yarn-cache-{{ .Branch }}- @@ -28,13 +29,38 @@ jobs: - ~/.cache/yarn - ./node_modules - ./example/node_modules + - persist_to_workspace: + root: ~ + paths: . + unit-tests-library: + executor: node-11 + steps: + - attach_workspace: + at: ~ - run: name: Test Library command: | yarn test:ci + unit-tests-example: + executor: node-11 + steps: + - attach_workspace: + at: ~ - run: - name: Test Example App + name: Test Example command: | cd example yarn test:ci yarn test:coverage +workflows: + version: 2 + build-and-test: + jobs: + - install-dependencies + - unit-tests-library: + requires: + - install-dependencies + - unit-tests-example: + requires: + - install-dependencies + From 51d50954b64a20b65c144bc1dd084e7584f4cd53 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Fri, 7 Dec 2018 01:33:46 +0100 Subject: [PATCH 3/6] Fix workspace paths --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f51407e1b7..e191e7b34b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,13 +30,13 @@ jobs: - ./node_modules - ./example/node_modules - persist_to_workspace: - root: ~ + root: . paths: . unit-tests-library: executor: node-11 steps: - attach_workspace: - at: ~ + at: . - run: name: Test Library command: | @@ -45,7 +45,7 @@ jobs: executor: node-11 steps: - attach_workspace: - at: ~ + at: . - run: name: Test Example command: | From e4bc72ddcf40b0bd0d78c3cb4547034110722d31 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Fri, 7 Dec 2018 13:44:18 +0100 Subject: [PATCH 4/6] Updated circleci config * Moved example dependency installation in test-example * Added caching for test dependencies * Picked shorter names for jobs * Updated executor to use node:11 --- .circleci/config.yml | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e191e7b34b..dc38d9164d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,9 @@ -# Note: all paths are relative to the default workspace ~/project version: 2.1 executors: node-11: docker: - - image: circleci/node:10 + - image: circleci/node:11 + jobs: install-dependencies: executor: node-11 @@ -12,7 +12,6 @@ jobs: - restore_cache: keys: # if lock file changes, we still use increasingly general patterns to restore cache - # the install afterwards will only install packages with different versions - yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} - yarn-cache-{{ .Branch }}- - run: @@ -20,47 +19,59 @@ jobs: command: | yarn --version yarn install --frozen-lockfile - cd example - yarn install --frozen-lockfile - save_cache: key: yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - ~/.yarn - ~/.cache/yarn - ./node_modules - - ./example/node_modules - persist_to_workspace: root: . paths: . - unit-tests-library: + + test-library: executor: node-11 steps: - attach_workspace: at: . - run: name: Test Library - command: | - yarn test:ci - unit-tests-example: + command: yarn test:ci + + install-test-example: executor: node-11 steps: - attach_workspace: at: . + - restore_cache: + keys: + - yarn-cache-example-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-cache-example-{{ .Branch }}- + - run: + name: Install Example Dependencies + command: | + cd example + yarn install --frozen-lockfile + - save_cache: + key: yarn-cache-example-{{ .Branch }}-{{ checksum "yarn.lock" }} + paths: + - ./example/node_modules - run: name: Test Example command: | cd example yarn test:ci yarn test:coverage + workflows: version: 2 build-and-test: jobs: - install-dependencies - - unit-tests-library: + - test-library: requires: - install-dependencies - - unit-tests-example: + - install-test-example: requires: - install-dependencies From ca2387844128ce3745fb8b24ba99bbdc4827b894 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Fri, 7 Dec 2018 13:48:58 +0100 Subject: [PATCH 5/6] Rename cache keys to avoid confusion with branches --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dc38d9164d..cfde6df413 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,15 +12,15 @@ jobs: - restore_cache: keys: # if lock file changes, we still use increasingly general patterns to restore cache - - yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-cache-{{ .Branch }}- + - yarn-cache-lib-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-cache-lib-{{ .Branch }}- - run: name: Install dependencies command: | yarn --version yarn install --frozen-lockfile - save_cache: - key: yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} + key: yarn-cache-lib-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - ~/.yarn - ~/.cache/yarn @@ -65,7 +65,7 @@ jobs: workflows: version: 2 - build-and-test: + install-and-test: jobs: - install-dependencies - test-library: From a4620e5119140126ce065b0aae7621ad5da58945 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Fri, 7 Dec 2018 14:17:28 +0100 Subject: [PATCH 6/6] Set executor to stable node version 10 --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cfde6df413..b39fd4acd6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,12 +1,12 @@ version: 2.1 executors: - node-11: + node-10: docker: - - image: circleci/node:11 + - image: circleci/node:10 jobs: install-dependencies: - executor: node-11 + executor: node-10 steps: - checkout - restore_cache: @@ -30,7 +30,7 @@ jobs: paths: . test-library: - executor: node-11 + executor: node-10 steps: - attach_workspace: at: . @@ -39,7 +39,7 @@ jobs: command: yarn test:ci install-test-example: - executor: node-11 + executor: node-10 steps: - attach_workspace: at: .