From 00906937a1fed2b612057f1065b20d3a06efb48d Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 19:01:39 -0230 Subject: [PATCH] ci: Use workspaces instead of caches for passing data downstream CircleCI no longer allows external PR builds to save caches so jobs that depend on cached data from a upstream job will no longer get the files they need. This change replaces our usages of caches for passing data downstream with workspaces, which appear to be the more correct feature to use. References: - https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs - https://circleci.com/blog/deep-diving-into-circleci-workspaces/ --- .circleci/config.yml | 136 +++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 89 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f441037df..c9d8cdf6a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,12 +98,14 @@ jobs: - restore_cache: keys: - v1.0-dependency-cache-{{ checksum "package-lock.json" }} - # fallback to using the latest cache if no exact match is found - - v1.0-dependency-cache- - run: name: Install npm 6 + deps via npm command: | sudo npm install -g npm@6 && npm install --no-save + - persist_to_workspace: + root: . + paths: + - node_modules - save_cache: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} paths: @@ -114,16 +116,16 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} + - attach_workspace: + at: . - run: name: build:dist command: npm run dist - run: name: build:debug command: find dist/ -type f -exec md5sum {} \; | sort -k 2 - - save_cache: - key: build-cache-{{ .Revision }} + - persist_to_workspace: + root: . paths: - dist - builds @@ -133,23 +135,23 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} + - attach_workspace: + at: . - run: name: build:dist command: npm run doc - - save_cache: - key: docs-cache-{{ .Revision }} + - persist_to_workspace: + root: . paths: - - docs/jsdoc + - docs/jsdocs prep-scss: docker: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} + - attach_workspace: + at: . - run: name: Get Scss Cache key # this allows us to checksum against a whole directory @@ -157,8 +159,8 @@ jobs: - run: name: Build for integration tests command: npm run test:integration:build - - save_cache: - key: scss-cache-{{ checksum "scss_checksum" }} + - persist_to_workspace: + root: . paths: - ui/app/css/output @@ -167,8 +169,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} + - attach_workspace: + at: . - run: name: Test command: npm run lint @@ -178,8 +180,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} + - attach_workspace: + at: . - run: name: Test command: npx nsp check @@ -189,10 +191,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} + - attach_workspace: + at: . - run: name: test:e2e:chrome command: npm run test:e2e:chrome @@ -208,10 +208,8 @@ jobs: - run: name: Install Firefox command: ./.circleci/scripts/firefox-install - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} + - attach_workspace: + at: . - run: name: test:e2e:firefox command: npm run test:e2e:firefox @@ -224,10 +222,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} + - attach_workspace: + at: . - run: name: test:e2e:chrome:beta command: npm run test:e2e:chrome:beta @@ -243,10 +239,8 @@ jobs: - run: name: Install Firefox command: ./.circleci/scripts/firefox-install - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} + - attach_workspace: + at: . - run: name: test:e2e:firefox:beta command: npm run test:e2e:firefox:beta @@ -259,15 +253,13 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} + - attach_workspace: + at: . - run: name: Test command: npm run test:screens - - save_cache: - key: job-screens-{{ .Revision }} + - persist_to_workspace: + root: . paths: - test-artifacts @@ -276,12 +268,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} - - restore_cache: - key: job-screens-{{ .Revision }} + - attach_workspace: + at: . - store_artifacts: path: dist/mascara destination: builds/mascara @@ -303,14 +291,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - restore_cache: - key: build-cache-{{ .Revision }} - - restore_cache: - key: docs-cache-{{ .Revision }} - - restore_cache: - key: job-screens-{{ .Revision }} + - attach_workspace: + at: . - run: name: sentry sourcemaps upload command: npm run sentry:publish @@ -326,8 +308,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} + - attach_workspace: + at: . - run: name: test:coverage command: npm run test:coverage @@ -337,17 +319,11 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout + - attach_workspace: + at: . - run: name: Install Firefox command: ./.circleci/scripts/firefox-install - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Get Scss Cache key - # this allows us to checksum against a whole directory - command: find ui/app/css -type f -exec md5sum {} \; | sort -k 2 > scss_checksum - - restore_cache: - key: scss-cache-{{ checksum "scss_checksum" }} - run: name: test:integration:flat command: npm run test:flat @@ -359,14 +335,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Get Scss Cache key - # this allows us to checksum against a whole directory - command: find ui/app/css -type f -exec md5sum {} \; | sort -k 2 > scss_checksum - - restore_cache: - key: scss-cache-{{ checksum "scss_checksum" }} + - attach_workspace: + at: . - run: name: test:integration:flat command: npm run test:flat @@ -376,17 +346,11 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout + - attach_workspace: + at: . - run: name: Install Firefox command: ./.circleci/scripts/firefox-install - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Get Scss Cache key - # this allows us to checksum against a whole directory - command: find ui/app/css -type f -exec md5sum {} \; | sort -k 2 > scss_checksum - - restore_cache: - key: scss-cache-{{ checksum "scss_checksum" }} - run: name: test:integration:mascara command: npm run test:mascara @@ -398,14 +362,8 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Get Scss Cache key - # this allows us to checksum against a whole directory - command: find ui/app/css -type f -exec md5sum {} \; | sort -k 2 > scss_checksum - - restore_cache: - key: scss-cache-{{ checksum "scss_checksum" }} + - attach_workspace: + at: . - run: name: test:integration:mascara command: npm run test:mascara