From e493efb1239d0c730dbcf23faaf7204cf69bc1d9 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 17 Aug 2018 11:13:47 -0230 Subject: [PATCH] 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 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."