From e493efb1239d0c730dbcf23faaf7204cf69bc1d9 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 11:13:47 -0230 Subject: ci: Don't cache Firefox install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two important notes: 1. The time it takes to download is negligble compared to e2e test runs 2. Since we cannot use environment variables in CircleCI cache keys we can't cache the download correctly and have it update when we switch firefox versions—this isn't the end of the world because of point 1 --- .circleci/config.yml | 49 +++++++---------------------------- .circleci/scripts/firefox-download.sh | 13 ---------- .circleci/scripts/firefox-install | 19 ++++++++++++++ .circleci/scripts/firefox-install.sh | 8 ------ 4 files changed, 28 insertions(+), 61 deletions(-) delete mode 100755 .circleci/scripts/firefox-download.sh create mode 100755 .circleci/scripts/firefox-install delete mode 100755 .circleci/scripts/firefox-install.sh (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d4bf270c..97eb33712 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,6 @@ workflows: full_test: jobs: - prep-deps-npm - - prep-deps-firefox - prep-build: requires: - prep-deps-npm @@ -28,7 +27,6 @@ workflows: - test-e2e-firefox: requires: - prep-deps-npm - - prep-deps-firefox - prep-build - test-e2e-beta-chrome: requires: @@ -37,7 +35,6 @@ workflows: - test-e2e-beta-firefox: requires: - prep-deps-npm - - prep-deps-firefox - prep-build - test-unit: requires: @@ -49,7 +46,6 @@ workflows: - test-integration-mascara-firefox: requires: - prep-deps-npm - - prep-deps-firefox - prep-scss - test-integration-flat-chrome: requires: @@ -58,7 +54,6 @@ workflows: - test-integration-flat-firefox: requires: - prep-deps-npm - - prep-deps-firefox - prep-scss - all-tests-pass: requires: @@ -113,20 +108,6 @@ jobs: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} paths: - node_modules - prep-deps-firefox: - docker: - - image: circleci/node:8.11.3-browsers - steps: - - checkout - - restore_cache: - key: v1.0-dependency-cache-firefox- - - run: - name: Download Firefox If needed - command: ./.circleci/scripts/firefox-download.sh - - save_cache: - key: v1.0-dependency-cache-firefox- - paths: - - firefox prep-build: docker: @@ -224,11 +205,9 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-firefox- - run: - name: Install firefox - command: ./.circleci/scripts/firefox-install.sh + name: Install Firefox + command: ./.circleci/scripts/firefox-install - restore_cache: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - restore_cache: @@ -261,11 +240,9 @@ jobs: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-firefox- - run: - name: Install firefox - command: ./.circleci/scripts/firefox-install.sh + name: Install Firefox + command: ./.circleci/scripts/firefox-install - restore_cache: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - restore_cache: @@ -356,17 +333,13 @@ jobs: command: npm run test:coverage test-integration-flat-firefox: - environment: - browsers: '["Firefox"]' docker: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-firefox- - run: - name: Install firefox - command: ./.circleci/scripts/firefox-install.sh + name: Install Firefox + command: ./.circleci/scripts/firefox-install - restore_cache: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - run: @@ -399,17 +372,13 @@ jobs: command: npm run test:flat test-integration-mascara-firefox: - environment: - browsers: '["Firefox"]' docker: - image: circleci/node:8.11.3-browsers steps: - checkout - - restore_cache: - key: v1.0-dependency-cache-firefox- - run: - name: Install firefox - command: ./.circleci/scripts/firefox-install.sh + name: Install Firefox + command: ./.circleci/scripts/firefox-install - restore_cache: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} - run: @@ -447,4 +416,4 @@ jobs: steps: - run: name: All Tests Passed - command: echo 'weew - everything passed!' \ No newline at end of file + command: echo 'weew - everything passed!' diff --git a/.circleci/scripts/firefox-download.sh b/.circleci/scripts/firefox-download.sh deleted file mode 100755 index 64f0c74e3..000000000 --- a/.circleci/scripts/firefox-download.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -echo "Checking if firefox was already downloaded" -if [ -d "firefox" ] -then - echo "Firefox found. No need to download" -else - FIREFOX_VERSION="61.0.1" - FIREFOX_BINARY="firefox-$FIREFOX_VERSION.tar.bz2" - echo "Downloading firefox..." - wget "https://ftp.mozilla.org/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/$FIREFOX_BINARY" \ - && tar xjf "$FIREFOX_BINARY" - echo "firefox download complete" -fi diff --git a/.circleci/scripts/firefox-install b/.circleci/scripts/firefox-install new file mode 100755 index 000000000..eb2028a27 --- /dev/null +++ b/.circleci/scripts/firefox-install @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +FIREFOX_VERSION='61.0.1' +FIREFOX_BINARY="firefox-${FIREFOX_VERSION}.tar.bz2" +FIREFOX_BINARY_URL="https://ftp.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/${FIREFOX_BINARY}" + +printf '%s\n' "Removing old Firefox installation" + +sudo rm -r /opt/firefox + +printf '%s\n' "Downloading & installing Firefox ${FIREFOX_VERSION}" + +wget --quiet --show-progress -O- "${FIREFOX_BINARY_URL}" | sudo tar xj -C /opt + +printf '%s\n' "Firefox ${FIREFOX_VERSION} installed" diff --git a/.circleci/scripts/firefox-install.sh b/.circleci/scripts/firefox-install.sh deleted file mode 100755 index 1c60f4de9..000000000 --- a/.circleci/scripts/firefox-install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -echo "Installing firefox..." -sudo rm -r /opt/firefox -sudo mv firefox /opt/firefox61 -sudo mv /usr/bin/firefox /usr/bin/firefox-old -sudo ln -s /opt/firefox61/firefox /usr/bin/firefox -echo "Firefox installed." -- cgit v1.2.3 From 7b89d3d47347b9033d57554cfbad58c8bbc41a50 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 11:47:50 -0230 Subject: ci: Disable Firefox updates --- .circleci/scripts/firefox-install | 12 +++++++++++- .circleci/scripts/firefox.cfg | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .circleci/scripts/firefox.cfg (limited to '.circleci') diff --git a/.circleci/scripts/firefox-install b/.circleci/scripts/firefox-install index eb2028a27..e2f93c5cd 100755 --- a/.circleci/scripts/firefox-install +++ b/.circleci/scripts/firefox-install @@ -7,13 +7,23 @@ set -o pipefail FIREFOX_VERSION='61.0.1' FIREFOX_BINARY="firefox-${FIREFOX_VERSION}.tar.bz2" FIREFOX_BINARY_URL="https://ftp.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/${FIREFOX_BINARY}" +FIREFOX_PATH='/opt/firefox' printf '%s\n' "Removing old Firefox installation" -sudo rm -r /opt/firefox +sudo rm -r "${FIREFOX_PATH}" printf '%s\n' "Downloading & installing Firefox ${FIREFOX_VERSION}" wget --quiet --show-progress -O- "${FIREFOX_BINARY_URL}" | sudo tar xj -C /opt printf '%s\n' "Firefox ${FIREFOX_VERSION} installed" + +{ + printf '%s\n' 'pref("general.config.filename", "firefox.cfg");' + printf '%s\n' 'pref("general.config.obscure_value", 0);' +} | sudo tee "${FIREFOX_PATH}/defaults/pref/autoconfig.js" + +sudo cp .circleci/scripts/firefox.cfg "${FIREFOX_PATH}" + +printf '%s\n' "Firefox ${FIREFOX_VERSION} configured" diff --git a/.circleci/scripts/firefox.cfg b/.circleci/scripts/firefox.cfg new file mode 100644 index 000000000..68dd285f2 --- /dev/null +++ b/.circleci/scripts/firefox.cfg @@ -0,0 +1,13 @@ +// IMPORTANT: Start your code on the 2nd line + +lockPref("app.update.enabled", false); +lockPref("app.update.auto", false); +lockPref("app.update.mode", 0); +lockPref("app.update.service.enabled", false); + +pref("browser.rights.3.shown", true); + +pref("browser.startup.homepage_override.mstone","ignore"); + +lockPref("plugins.hide_infobar_for_outdated_plugin", true); +clearPref("plugins.update.url"); -- cgit v1.2.3 From 2185197ef6a88dcedf8ceb6ddf4877008e6d7948 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 11:25:57 -0230 Subject: ci: Use Firefox 61.0.2 --- .circleci/scripts/firefox-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.circleci') diff --git a/.circleci/scripts/firefox-install b/.circleci/scripts/firefox-install index e2f93c5cd..1d8e62d76 100755 --- a/.circleci/scripts/firefox-install +++ b/.circleci/scripts/firefox-install @@ -4,7 +4,7 @@ set -e set -u set -o pipefail -FIREFOX_VERSION='61.0.1' +FIREFOX_VERSION='61.0.2' FIREFOX_BINARY="firefox-${FIREFOX_VERSION}.tar.bz2" FIREFOX_BINARY_URL="https://ftp.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/${FIREFOX_BINARY}" FIREFOX_PATH='/opt/firefox' -- cgit v1.2.3 From 8f834ed87d2bf77227fe9abfb8799e045e948202 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 18:51:02 -0230 Subject: ci: Install any npm@6 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index 97eb33712..f441037df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ jobs: - run: name: Install npm 6 + deps via npm command: | - sudo npm install -g npm@6.1.0 && npm install --no-save + sudo npm install -g npm@6 && npm install --no-save - save_cache: key: v1.0-dependency-cache-{{ checksum "package-lock.json" }} paths: -- cgit v1.2.3 From 00906937a1fed2b612057f1065b20d3a06efb48d Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 19:01:39 -0230 Subject: 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(-) (limited to '.circleci') 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 -- cgit v1.2.3