From eda45ec5040306fb3b781d99c125d06292ac3c9a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 15:09:48 +0200 Subject: [PATCH 01/21] update browser tools --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a597efbfc..2446002afc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ parameters: type: boolean default: false orbs: - browser-tools: circleci/browser-tools@1.4.3 + browser-tools: circleci/browser-tools@1.4.4 jobs: build: docker: From fa3c9e87fca076f7ff692fac7429702a6a6143ea Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 15:13:34 +0200 Subject: [PATCH 02/21] 110 --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2446002afc..6bec331b3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -144,6 +144,7 @@ jobs: - browser-tools/install-browser-tools: install-firefox: false install-chrome: true + chrome-version: 116.0.5845.110 install-geckodriver: false install-chromedriver: true - run: google-chrome --version From 79966a5721657216055ef2c06e89c2770ea4011e Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 17:18:32 +0200 Subject: [PATCH 03/21] 96 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6bec331b3c..d913695187 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -144,7 +144,7 @@ jobs: - browser-tools/install-browser-tools: install-firefox: false install-chrome: true - chrome-version: 116.0.5845.110 + chrome-version: 116.0.5845.96 install-geckodriver: false install-chromedriver: true - run: google-chrome --version From 760f033bda621f6ca19bdef212c9b12db50585cb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 17:30:35 +0200 Subject: [PATCH 04/21] do not install driver --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d913695187..6ff2f6c954 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -144,9 +144,8 @@ jobs: - browser-tools/install-browser-tools: install-firefox: false install-chrome: true - chrome-version: 116.0.5845.96 + install-chromedriver: false install-geckodriver: false - install-chromedriver: true - run: google-chrome --version - run: chromedriver --version - run: rm LICENSE.chromedriver 2> /dev/null || true From 9f2805a9fcb7cb5e1eeba8414074f391a5d445cd Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 17:30:56 +0200 Subject: [PATCH 05/21] disable auto chromedriver install --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ff2f6c954..07a497481b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -202,7 +202,7 @@ jobs: install-firefox: false install-chrome: true install-geckodriver: false - install-chromedriver: true + install-chromedriver: false - run: google-chrome --version - run: chromedriver --version - run: rm LICENSE.chromedriver 2> /dev/null || true From 60bdf77da9d0ebcedac922ad4bc3a1c45d86f060 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 17:41:17 +0200 Subject: [PATCH 06/21] add commands --- .circleci/config.yml | 553 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 550 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 07a497481b..4f811b2836 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,8 +4,6 @@ parameters: run_flaky_tests: type: boolean default: false -orbs: - browser-tools: circleci/browser-tools@1.4.4 jobs: build: docker: @@ -366,4 +364,553 @@ workflows: branches: only: remix_beta -# VS Code Extension Version: 1.5.1 +# commands +commands: + install-browser-tools: + description: | + Install various browsers and browser-testing tools into any Debian/Ubuntu-based Docker image. Intended to ease browser testing on CircleCI. Requirements: bash, curl, apt-get, gpg, sha256sum, sed, tar, unzip, grep + parameters: + chrome-version: + default: latest + description: | + Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian + type: string + chromedriver-install-dir: + default: /usr/local/bin + description: | + Directory in which to install Chromedriver + type: string + firefox-install-dir: + default: /usr/local/bin + description: | + Directory in which to install Firefox + type: string + firefox-version: + default: latest + description: | + Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, e.g., 66.0.3, 53.0, etc. + type: string + geckodriver-install-dir: + default: /usr/local/bin + description: | + Directory in which to install Geckodriver + type: string + geckodriver-version: + default: latest + description: | + Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html + type: string + install-chrome: + default: true + description: | + Install Google Chrome? Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases. + type: boolean + install-chromedriver: + default: true + description: | + Install Chromedriver? Note: requires Google Chrome. A Chromedriver version will be dynamically selected based on the installed version of Chrome; for details, see the following information: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection + type: boolean + install-firefox: + default: true + description: Install Firefox? + type: boolean + install-geckodriver: + default: true + description: Install Geckodriver? + type: boolean + replace-existing-chrome: + default: false + description: | + If there is an existing installation of Google Chrome, replace it with the latest stable release + type: boolean + steps: + - when: + condition: <> + steps: + - install-firefox: + install-dir: <> + version: <> + - when: + condition: <> + steps: + - install-geckodriver: + install-dir: <> + version: <> + - when: + condition: <> + steps: + - install-chrome: + chrome-version: <> + replace-existing: <> + - when: + condition: <> + steps: + - install-chromedriver: + install-dir: <> + install-chrome: + description: | + Install Google's Chrome browser, for use in browser testing. Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases. Supports Debian/Ubuntu Linux, Alpine Linux (via Chromium), and macOS environments. + parameters: + channel: + default: stable + description: | + The release channel of Google Chrome to use. Defaults to 'stable'. + enum: + - stable + - beta + type: enum + chrome-version: + default: latest + description: | + Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian If replace-existing is false, this version is ignored. + type: string + replace-existing: + default: false + description: | + If there is an existing installation of Google Chrome, replace it with the latest stable release? + type: boolean + steps: + - run: + command: | + #!/bin/bash + if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi + # installation check + if uname -a | grep Darwin >/dev/null 2>&1; then + if ls /Applications/*Google\ Chrome* >/dev/null 2>&1; then + if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then + echo "$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)is currently installed; replacing it" + HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall google-chrome >/dev/null 2>&1 || true + $SUDO rm -rf /Applications/Google\ Chrome.app >/dev/null 2>&1 || true + else + echo "$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)is already installed" + exit 0 + fi + else + echo "Google Chrome is not currently installed; installing it" + fi + elif grep Alpine /etc/issue >/dev/null 2>&1; then + if command -v chromium-browser >/dev/null 2>&1; then + if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then + echo "$(chromium-browser --version)is currently installed; replacing it" + $SUDO apk del --force-broken-world chromium >/dev/null 2>&1 || true + $SUDO rm -f "$(command -v chromium-browser)" >/dev/null 2>&1 || true + else + echo "$(chromium-browser --version)is already installed to $(command -v chromium-browser)" + exit 0 + fi + else + echo "Google Chrome (via Chromium) is not currently installed; installing it" + fi + elif command -v yum >/dev/null 2>&1; then + if command -v google-chrome >/dev/null 2>&1; then + if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then + echo "$(google-chrome --version)is currently installed; replacing it" + $SUDO yum remove -y google-chrome-stable >/dev/null 2>&1 || true + $SUDO rm -f "$(command -v google-chrome)" >/dev/null 2>&1 || true + else + echo "$(google-chrome --version)is already installed to $(command -v google-chrome)" + exit 0 + fi + else + echo "Google Chrome is not currently installed; installing it" + fi + else + if command -v google-chrome >/dev/null 2>&1; then + if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then + echo "$(google-chrome --version)is currently installed; replacing it" + $SUDO apt-get -y --purge remove google-chrome-stable >/dev/null 2>&1 || true + $SUDO rm -f "$(command -v google-chrome)" >/dev/null 2>&1 || true + else + echo "$(google-chrome --version)is already installed to $(command -v google-chrome)" + exit 0 + fi + else + echo "Google Chrome is not currently installed; installing it" + fi + fi + + # install chrome + if uname -a | grep Darwin >/dev/null 2>&1; then + echo "Preparing Chrome installation for MacOS-based systems" + # Universal MacOS .pkg with license pre-accepted: https://support.google.com/chrome/a/answer/9915669?hl=en + CHROME_MAC_URL="https://dl.google.com/chrome/mac/${ORB_PARAM_CHANNEL}/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg" + CHROME_TEMP_DIR="$(mktemp -d)" + curl -L -o "$CHROME_TEMP_DIR/googlechrome.pkg" "$CHROME_MAC_URL" + sudo /usr/sbin/installer -pkg "$CHROME_TEMP_DIR/googlechrome.pkg" -target / + sudo rm -rf "$CHROME_TEMP_DIR" + echo '#!/usr/bin/env bash' >> google-chrome-$ORB_PARAM_CHANNEL + if [[ $ORB_PARAM_CHANNEL == "beta" ]]; then + xattr -rc "/Applications/Google Chrome Beta.app" + echo '/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta "$@"' >> google-chrome-$ORB_PARAM_CHANNEL + else + xattr -rc "/Applications/Google Chrome.app" + echo '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "$@"' >> google-chrome-$ORB_PARAM_CHANNEL + fi + sudo mv google-chrome-$ORB_PARAM_CHANNEL /usr/local/bin/ + sudo chmod +x /usr/local/bin/google-chrome-$ORB_PARAM_CHANNEL + # test/verify installation + if google-chrome-$ORB_PARAM_CHANNEL --version >/dev/null 2>&1; then + echo "$(google-chrome-$ORB_PARAM_CHANNEL --version)has been installed in the /Applications directory" + echo "A shortcut has also been created at $(command -v google-chrome)" + exit 0 + else + echo "The latest release of Google Chrome (${ORB_PARAM_CHANNEL}) failed to install." + exit 1 + fi + elif command -v yum >/dev/null 2>&1; then + echo "Preparing Chrome installation for RedHat-based systems" + # download chrome + if [[ "$ORB_PARAM_CHROME_VERSION" == "latest" ]]; then + CHROME_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm" + else + CHROME_URL="https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-${ORB_PARAM_CHANNEL}-$ORB_PARAM_CHROME_VERSION-1.x86_64.rpm" + fi + curl --silent --show-error --location --fail --retry 3 \ + --output google-chrome.rpm \ + "$CHROME_URL" + curl --silent --show-error --location --fail --retry 3 \ + --output liberation-fonts.rpm \ + http://mirror.centos.org/centos/7/os/x86_64/Packages/liberation-fonts-1.07.2-16.el7.noarch.rpm + $SUDO yum localinstall -y liberation-fonts.rpm \ + >/dev/null 2>&1 + $SUDO yum localinstall -y google-chrome.rpm \ + >/dev/null 2>&1 + rm -rf google-chrome.rpm liberation-fonts.rpm + else + # download chrome + echo "Preparing Chrome installation for Debian-based systems" + if [[ "$ORB_PARAM_CHROME_VERSION" == "latest" ]]; then + ENV_IS_ARM=$(! dpkg --print-architecture | grep -q arm; echo $?) + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | $SUDO apt-key add - + if [ "$ENV_IS_ARM" == "arm" ]; then + echo "Installing Chrome for ARM64" + $SUDO sh -c 'echo "deb [arch=arm64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' + else + echo "Installing Chrome for AMD64" + $SUDO sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' + fi + $SUDO apt-get update + DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y google-chrome-${ORB_PARAM_CHANNEL} + else + # Google does not keep older releases in their PPA, but they can be installed manually. HTTPS should be enough to secure the download. + wget --no-verbose -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${ORB_PARAM_CHROME_VERSION}-1_amd64.deb" \ + && $SUDO apt-get install -y /tmp/chrome.deb \ + && rm /tmp/chrome.deb + fi + fi + + # test/verify installation + if [[ "$ORB_PARAM_CHROME_VERSION" != "latest" ]]; then + if google-chrome-$ORB_PARAM_CHANNEL --version | grep "$ORB_PARAM_CHROME_VERSION" >/dev/null 2>&1; then + : + else + echo "Google Chrome v${ORB_PARAM_CHROME_VERSION} (${ORB_PARAM_CHANNEL}) failed to install." + exit 1 + fi + else + if google-chrome-$ORB_PARAM_CHANNEL --version >/dev/null 2>&1; then + : + else + echo "The latest release of Google Chrome (${ORB_PARAM_CHANNEL}) failed to install." + exit 1 + fi + echo "$(google-chrome-$ORB_PARAM_CHANNEL --version) has been installed to $(command -v google-chrome-$ORB_PARAM_CHANNEL)" + echo "Chrome: $ORB_PARAM_CHROME_VERSION" >>"${HOME}/.browser-versions" + fi + environment: + ORB_PARAM_CHANNEL: << parameters.channel >> + ORB_PARAM_CHROME_VERSION: <> + ORB_PARAM_REPLACE_EXISTING: <> + name: Install Google Chrome + install-chromedriver: + description: | + Install Google's ChromeDriver WebDriver proxy, for use in browser testing with Chrome. A ChromeDriver version will be dynamically selected based on the installed version of Chrome; for details, see https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection Requirements: sed, curl, unzip + parameters: + install-dir: + default: /usr/local/bin + description: | + Directory in which to install ChromeDriver (directory selection not supported on Alpine Linux) + type: string + steps: + - run: + command: "#!/bin/bash\nif [[ $EUID == 0 ]]; then export SUDO=\"\"; else export SUDO=\"sudo\"; fi\n# determine_chrome_version\nif uname -a | grep Darwin >/dev/null 2>&1; then\n echo \"System detected as MacOS\"\n\n if [ -f \"/usr/local/bin/google-chrome-stable\" ]; then\n CHROME_VERSION=\"$(/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version)\"\n else\n CHROME_VERSION=\"$(/Applications/Google\\ Chrome\\ Beta.app/Contents/MacOS/Google\\ Chrome\\ Beta --version)\"\n fi\n PLATFORM=mac64\n\nelif grep Alpine /etc/issue >/dev/null 2>&1; then\n apk update >/dev/null 2>&1 &&\n apk add --no-cache chromium-chromedriver >/dev/null\n\n # verify version\n echo \"$(chromedriver --version) has been installed to $(command -v chromedriver)\"\n\n exit 0\nelse\n CHROME_VERSION=\"$(google-chrome --version)\"\n PLATFORM=linux64\nfi\n\nCHROME_VERSION_STRING=\"$(echo \"$CHROME_VERSION\" | sed 's/.*Google Chrome //' | sed 's/.*Chromium //')\"\n\n# print Chrome version\necho \"Installed version of Google Chrome is $CHROME_VERSION_STRING\"\n\n# determine chromedriver release\nCHROMEDRIVER_RELEASE=\"${CHROME_VERSION_STRING%%.*}\"\n\nCHROME_RELEASE=\"${CHROMEDRIVER_RELEASE}\"\n\nif [[ $CHROME_RELEASE -lt 70 ]]; then\n # https://sites.google.com/a/chromium.org/chromedriver/downloads\n # https://chromedriver.storage.googleapis.com/2.40/notes.txt\n\n case $CHROME_RELEASE in\n 69)\n CHROMEDRIVER_VERSION=\"2.44\"\n ;;\n 68)\n CHROMEDRIVER_VERSION=\"2.42\"\n ;;\n 67)\n CHROMEDRIVER_VERSION=\"2.41\"\n ;;\n 66)\n CHROMEDRIVER_VERSION=\"2.40\"\n ;;\n 65)\n CHROMEDRIVER_VERSION=\"2.38\"\n ;;\n 64)\n CHROMEDRIVER_VERSION=\"2.37\"\n ;;\n 63)\n CHROMEDRIVER_VERSION=\"2.36\"\n ;;\n 62)\n CHROMEDRIVER_VERSION=\"2.35\"\n ;;\n 61)\n CHROMEDRIVER_VERSION=\"2.34\"\n ;;\n 60)\n CHROMEDRIVER_VERSION=\"2.33\"\n ;;\n 59)\n CHROMEDRIVER_VERSION=\"2.32\"\n ;;\n 58)\n CHROMEDRIVER_VERSION=\"2.31\"\n ;;\n 57)\n CHROMEDRIVER_VERSION=\"2.29\"\n ;;\n 56)\n CHROMEDRIVER_VERSION=\"2.29\"\n ;;\n 55)\n CHROMEDRIVER_VERSION=\"2.28\"\n ;;\n 54)\n CHROMEDRIVER_VERSION=\"2.27\"\n ;;\n 53)\n CHROMEDRIVER_VERSION=\"2.26\"\n ;;\n 52)\n CHROMEDRIVER_VERSION=\"2.24\"\n ;;\n 51)\n CHROMEDRIVER_VERSION=\"2.23\"\n ;;\n 50)\n CHROMEDRIVER_VERSION=\"2.22\"\n ;;\n 49)\n CHROMEDRIVER_VERSION=\"2.22\"\n ;;\n 48)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 47)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 46)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 45)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n 44)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n 43)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n *)\n echo \"Sorry, Google Chrome/Chromium version 43 or newer is required to use ChromeDriver\"\n exit 1\n ;;\n esac\n elif [[ $CHROME_RELEASE -lt 115 ]]; then\n CHROMEDRIVER_VERSION=$(curl --silent --show-error --location --fail --retry 3 \\\n \"https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEDRIVER_RELEASE\")\n else\n # shellcheck disable=SC2001\n CHROMEDRIVER_VERSION=$(echo $CHROME_VERSION | sed 's/[^0-9.]//g')\nfi\n\n# installation check\nif command -v chromedriver >/dev/null 2>&1; then\n if chromedriver --version | grep \"$CHROMEDRIVER_VERSION\" >/dev/null 2>&1; then\n echo \"ChromeDriver $CHROMEDRIVER_VERSION is already installed\"\n exit 0\n else\n echo \"A different version of ChromeDriver is installed ($(chromedriver --version)); removing it\"\n $SUDO rm -f \"$(command -v chromedriver)\"\n fi\nfi\n\necho \"ChromeDriver $CHROMEDRIVER_VERSION will be installed\"\n\n# download chromedriver\nif [[ $CHROME_RELEASE -lt 115 ]]; then\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_$PLATFORM.zip\"\nelse \n echo \"$CHROMEDRIVER_VERSION will be installed\"\n if [[ $PLATFORM == \"linux64\" ]]; then\n PLATFORM=\"linux64\"\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip\"\n elif [[ $PLATFORM == \"mac64\" ]]; then\n PLATFORM=\"mac-x64\"\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/mac-x64/chromedriver-mac-x64.zip\"\n else\n PLATFORM=\"win64\"\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/win64/chromedriver-win64.zip\"\n fi\nfi\n\n# setup chromedriver installation\nif command -v yum >/dev/null 2>&1; then\n yum install -y unzip >/dev/null 2>&1\nfi\n\nunzip \"chromedriver_$PLATFORM.zip\" >/dev/null 2>&1\nrm -rf \"chromedriver_$PLATFORM.zip\"\n\nif [[ $CHROME_RELEASE -gt 114 ]]; then\n mv \"chromedriver-$PLATFORM\" chromedriver\n $SUDO mv chromedriver/chromedriver \"$ORB_PARAM_DRIVER_INSTALL_DIR\"\n rm -rf \"chromedriver\"\nelse\n $SUDO mv chromedriver \"$ORB_PARAM_DRIVER_INSTALL_DIR\"\nfi\n\n\n$SUDO chmod +x \"$ORB_PARAM_DRIVER_INSTALL_DIR/chromedriver\" \n\n\n# test/verify version\n if chromedriver --version | grep \"$CHROMEDRIVER_VERSION\" >/dev/null 2>&1; then\n echo \"$(chromedriver --version) has been installed to $(command -v chromedriver)\"\n readonly base_dir=\"${CIRCLE_WORKING_DIRECTORY/\\~/$HOME}\"\n rm -f \"${base_dir}/LICENSE.chromedriver\"\n else\n echo \"Something went wrong; ChromeDriver could not be installed\"\n exit 1\n fi\n" + environment: + ORB_PARAM_DRIVER_INSTALL_DIR: <> + name: Install ChromeDriver + install-firefox: + description: | + Install Mozilla's Firefox browser, for use in browser testing. Requires apt-get, gpg, curl, sha256sum, tar, jq + parameters: + install-dir: + default: /usr/local/bin + description: | + Directory in which to install Firefox + type: string + version: + default: latest + description: | + Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, ESR or otherwise, e.g., 66.0.3, 52.0.1esr, 53.0, etc. + type: string + steps: + - run: + command: | + #!/bin/bash + if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi + # FUNCTIONS + grab_firefox_version() { + if [[ "$ORB_PARAM_FIREFOX_VERSION" == "latest" ]]; then + # extract latest version from mozilla product details API + + FIREFOX_VERSION_STRING=$(curl \ + https://product-details.mozilla.org/1.0/firefox_versions.json | + jq '.LATEST_FIREFOX_VERSION') + + # strip leading/trailing " + temp="${FIREFOX_VERSION_STRING%\"}" + FIREFOX_VERSION="${temp#\"}" + echo "Latest stable version of Firefox is $FIREFOX_VERSION" + else + FIREFOX_VERSION="$ORB_PARAM_FIREFOX_VERSION" + echo "Selected version of Firefox is $FIREFOX_VERSION" + fi + + # create Firefox download URL base + FIREFOX_URL_BASE="https://archive.mozilla.org/pub/firefox/releases/$FIREFOX_VERSION" + } + + installation_check() { + if command -v firefox >/dev/null 2>&1; then + if firefox --version | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then + echo "firefox $FIREFOX_VERSION is already installed" + exit 0 + else + echo "A different version of Firefox is installed ($(firefox --version)); removing it" + $SUDO rm -f "$(command -v firefox)" + fi + fi + } + + # mac: setup version, install packages, then continue + if uname -a | grep Darwin >/dev/null 2>&1; then + echo "System detected as MacOS" + grab_firefox_version + installation_check + HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg coreutils >/dev/null 2>&1 + # deb/ubuntu/other linux: setup version, install packages, then continue + else + echo "System detected as Linux" + grab_firefox_version + installation_check + + if command -v yum >/dev/null 2>&1; then + $SUDO yum install -y \ + alsa-lib \ + bzip2 \ + dbus-glib-devel \ + gtk2-devel \ + gtk3-devel \ + libXt-devel \ + perl \ + which \ + >/dev/null 2>&1 + else + $SUDO apt-get update >/dev/null 2>&1 && + $SUDO apt-get install -y \ + libasound-dev \ + libxt6 \ + libgtk-3-dev \ + libdbus-glib-1-2 \ + >/dev/null 2>&1 + fi + fi + + # import public key + curl --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/KEY" | gpg --import >/dev/null 2>&1 + + # download shasums + curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA256SUMS.asc" || curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA512SUMS.asc" + curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA256SUMS" || curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA512SUMS" + + # verify shasums + gpg --verify SHA256SUMS.asc SHA256SUMS || gpg --verify SHA512SUMS.asc SHA512SUMS + rm -f SHA256SUMS.asc || rm -f SHA512SUMS.asc + + # setup firefox download + if uname -a | grep Darwin >/dev/null 2>&1; then + FIREFOX_FILE="Firefox%20$FIREFOX_VERSION" + PLATFORM=mac + FILE_EXT=dmg + else + FIREFOX_FILE="firefox-$FIREFOX_VERSION" + PLATFORM=linux-x86_64 + FILE_EXT=tar.bz2 + fi + + FIREFOX_FILE_LOCATION="$PLATFORM/en-US/$FIREFOX_FILE" + + FIREFOX_FILE_NAME="$PLATFORM-en-US-$FIREFOX_FILE" + + # download firefox + curl --silent --show-error --location --fail --retry 3 \ + --output "$FIREFOX_FILE_NAME.$FILE_EXT" \ + "$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT" + + if uname -a | grep Darwin >/dev/null 2>&1; then + echo "No PGP data for macOS Firefox releases; skipping PGP verification" + + perl -i -pe "s&mac/en-US/Firefox $FIREFOX_VERSION&mac-en-US-Firefox%20$FIREFOX_VERSION&g" SHA256SUMS + perl -i -pe "s&mac/en-US/Firefox $FIREFOX_VERSION&mac-en-US-Firefox%20$FIREFOX_VERSION&g" SHA512SUMS + else + # only do this step if .asc file exists for this version + if [[ $(curl --silent --location --fail --retry 3 \ + "$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT.asc") ]]; then + + curl --silent --show-error --location --fail --retry 3 \ + --output "$FIREFOX_FILE_NAME.$FILE_EXT.asc" \ + "$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT.asc" + + # verify download archive + gpg --verify "$FIREFOX_FILE_NAME.$FILE_EXT.asc" "$FIREFOX_FILE_NAME.$FILE_EXT" + rm -f "$FIREFOX_FILE_NAME.$FILE_EXT.asc" + fi + + perl -i -pe "s%linux-x86_64/en-US/firefox%linux-x86_64-en-US-firefox%g" SHA256SUMS + perl -i -pe "s%linux-x86_64/en-US/firefox%linux-x86_64-en-US-firefox%g" SHA512SUMS + fi + + grep "$FIREFOX_FILE_NAME.$FILE_EXT" SHA256SUMS | sha256sum -c - || + grep "$FIREFOX_FILE_NAME.$FILE_EXT" SHA512SUMS | sha512sum -c - + rm -f SHA256SUMS || rm -f SHA512SUMS + + # setup firefox installation + if uname -a | grep Darwin >/dev/null 2>&1; then + hdiutil attach "$FIREFOX_FILE_NAME.$FILE_EXT" >/dev/null 2>&1 + $SUDO cp -R /Volumes/Firefox/Firefox.app /Applications + + hdiutil eject /Volumes/Firefox >/dev/null 2>&1 + $SUDO rm -f "$FIREFOX_FILE_NAME.$FILE_EXT" + + echo -e "#\!/bin/bash\n" >firefox + perl -i -pe "s|#\\\|#|g" firefox + echo -e "/Applications/Firefox.app/Contents/MacOS/firefox \"\$@\"" >>firefox + + $SUDO mv firefox "$ORB_PARAM_FIREFOX_INSTALL_DIR" + $SUDO chmod +x "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox" + + # test/verify version + if firefox --version | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then + echo "$(firefox --version) has been installed in the /Applications directory" + echo "A shortcut has also been created at $(command -v firefox)" + else + echo "Something went wrong; the specified version of Firefox could not be installed" + exit 1 + fi + + else + $SUDO tar -xjf "$FIREFOX_FILE_NAME.$FILE_EXT" + $SUDO rm -f "$FIREFOX_FILE_NAME.$FILE_EXT" + $SUDO mv firefox "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION" + $SUDO chmod +x "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION/firefox" + $SUDO ln -s "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION/firefox" /usr/local/bin/firefox + + # test/verify version + if echo "$(firefox --version)esr" | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then + echo "$(firefox --version) has been installed to $(command -v firefox)" + else + echo "Something went wrong; the specified version of Firefox could not be installed" + exit 1 + fi + fi + environment: + ORB_PARAM_FIREFOX_INSTALL_DIR: <> + ORB_PARAM_FIREFOX_VERSION: <> + name: Install Firefox + install-geckodriver: + description: | + Install Mozilla's Geckodriver WebDriver proxy, for use in browser testing with Firefox. Requirements: curl, tar + parameters: + install-dir: + default: /usr/local/bin + description: | + Directory in which to install Geckodriver + type: string + version: + default: latest + description: | + Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html + type: string + steps: + - run: + command: | + #!/bin/bash + if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi + # FUNCTIONS + grab_geckodriver_version() { + if [[ "$ORB_PARAM_GECKO_VERSION" == "latest" ]]; then + # extract latest version from github releases API + GECKODRIVER_VERSION_STRING=$(curl -Ls -o /dev/null -w "%{url_effective}\n" "https://github.com/mozilla/geckodriver/releases/latest" | sed 's:.*/::') + + # strip leading/trailing " + temp="${GECKODRIVER_VERSION_STRING%\"}" + GECKODRIVER_VERSION="${temp#\"}" + else + GECKODRIVER_VERSION="$ORB_PARAM_GECKO_VERSION" + fi + + echo "Selected version of Geckodriver is: $GECKODRIVER_VERSION" + } + + installation_check() { + if command -v geckodriver >>/dev/null 2>&1; then + if geckodriver --version | grep "$GECKODRIVER_VERSION" >>/dev/null 2>&1; then + echo "Geckodriver $GECKODRIVER_VERSION is already installed" + exit 0 + else + echo "A different version of Geckodriver is installed ($(geckodriver --version)); removing it" + $SUDO rm -rf "$(command -v geckodriver)" + fi + else + echo "Geckodriver is not currently installed; installing it" + fi + } + + grab_geckodriver_version + installation_check + + if uname -a | grep Darwin >>/dev/null 2>&1; then + PLATFORM=macos + else + PLATFORM=linux64 + fi + + # get download URL + GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" + + # download geckodriver + $SUDO curl --silent --show-error --location --fail --retry 3 --output "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" "$GECKODRIVER_URL" + + # setup geckodriver installation + $SUDO tar xf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" + $SUDO rm -rf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" + + $SUDO mv geckodriver "$ORB_PARAM_GECKO_INSTALL_DIR" + $SUDO chmod +x "$ORB_PARAM_GECKO_INSTALL_DIR/geckodriver" + + # verify version + echo "Geckodriver has been installed to $(command -v geckodriver)" + geckodriver --version + + # test/verify version + + GECKODRIVER_VERSION_NUM="$(echo "$GECKODRIVER_VERSION" | sed -E 's/v//')" + + if geckodriver --version | grep "$GECKODRIVER_VERSION_NUM" >/dev/null 2>&1; then + echo "$(geckodriver --version) has been installed to $(command -v geckodriver)" + else + echo "Something went wrong; the specified version of Geckodriver could not be installed" + exit 1 + fi + environment: + ORB_PARAM_GECKO_INSTALL_DIR: <> + ORB_PARAM_GECKO_VERSION: <> + name: Install Geckodriver From 7471c582031dc63091532ee22d6bf9b06d4f1dbb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 17:42:38 +0200 Subject: [PATCH 07/21] custom command --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f811b2836..9c1286f64a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,7 +139,7 @@ jobs: condition: equal: [ "chrome", << parameters.browser >> ] steps: - - browser-tools/install-browser-tools: + - install-browser-tools: install-firefox: false install-chrome: true install-chromedriver: false @@ -151,7 +151,7 @@ jobs: condition: equal: [ "firefox", << parameters.browser >> ] steps: - - browser-tools/install-browser-tools: + - install-browser-tools: install-firefox: true install-chrome: false install-geckodriver: true @@ -196,7 +196,7 @@ jobs: default: 1 parallelism: << parameters.parallelism >> steps: - - browser-tools/install-browser-tools: + - install-browser-tools: install-firefox: false install-chrome: true install-geckodriver: false From 7129dfb80ad309cf3e05419349d2cb45a32bf26c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 17:59:07 +0200 Subject: [PATCH 08/21] rm commands --- .circleci/config.yml | 559 +------------------------------------------ 1 file changed, 6 insertions(+), 553 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9c1286f64a..07a497481b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,6 +4,8 @@ parameters: run_flaky_tests: type: boolean default: false +orbs: + browser-tools: circleci/browser-tools@1.4.4 jobs: build: docker: @@ -139,7 +141,7 @@ jobs: condition: equal: [ "chrome", << parameters.browser >> ] steps: - - install-browser-tools: + - browser-tools/install-browser-tools: install-firefox: false install-chrome: true install-chromedriver: false @@ -151,7 +153,7 @@ jobs: condition: equal: [ "firefox", << parameters.browser >> ] steps: - - install-browser-tools: + - browser-tools/install-browser-tools: install-firefox: true install-chrome: false install-geckodriver: true @@ -196,7 +198,7 @@ jobs: default: 1 parallelism: << parameters.parallelism >> steps: - - install-browser-tools: + - browser-tools/install-browser-tools: install-firefox: false install-chrome: true install-geckodriver: false @@ -364,553 +366,4 @@ workflows: branches: only: remix_beta -# commands -commands: - install-browser-tools: - description: | - Install various browsers and browser-testing tools into any Debian/Ubuntu-based Docker image. Intended to ease browser testing on CircleCI. Requirements: bash, curl, apt-get, gpg, sha256sum, sed, tar, unzip, grep - parameters: - chrome-version: - default: latest - description: | - Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian - type: string - chromedriver-install-dir: - default: /usr/local/bin - description: | - Directory in which to install Chromedriver - type: string - firefox-install-dir: - default: /usr/local/bin - description: | - Directory in which to install Firefox - type: string - firefox-version: - default: latest - description: | - Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, e.g., 66.0.3, 53.0, etc. - type: string - geckodriver-install-dir: - default: /usr/local/bin - description: | - Directory in which to install Geckodriver - type: string - geckodriver-version: - default: latest - description: | - Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html - type: string - install-chrome: - default: true - description: | - Install Google Chrome? Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases. - type: boolean - install-chromedriver: - default: true - description: | - Install Chromedriver? Note: requires Google Chrome. A Chromedriver version will be dynamically selected based on the installed version of Chrome; for details, see the following information: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection - type: boolean - install-firefox: - default: true - description: Install Firefox? - type: boolean - install-geckodriver: - default: true - description: Install Geckodriver? - type: boolean - replace-existing-chrome: - default: false - description: | - If there is an existing installation of Google Chrome, replace it with the latest stable release - type: boolean - steps: - - when: - condition: <> - steps: - - install-firefox: - install-dir: <> - version: <> - - when: - condition: <> - steps: - - install-geckodriver: - install-dir: <> - version: <> - - when: - condition: <> - steps: - - install-chrome: - chrome-version: <> - replace-existing: <> - - when: - condition: <> - steps: - - install-chromedriver: - install-dir: <> - install-chrome: - description: | - Install Google's Chrome browser, for use in browser testing. Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases. Supports Debian/Ubuntu Linux, Alpine Linux (via Chromium), and macOS environments. - parameters: - channel: - default: stable - description: | - The release channel of Google Chrome to use. Defaults to 'stable'. - enum: - - stable - - beta - type: enum - chrome-version: - default: latest - description: | - Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian If replace-existing is false, this version is ignored. - type: string - replace-existing: - default: false - description: | - If there is an existing installation of Google Chrome, replace it with the latest stable release? - type: boolean - steps: - - run: - command: | - #!/bin/bash - if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi - # installation check - if uname -a | grep Darwin >/dev/null 2>&1; then - if ls /Applications/*Google\ Chrome* >/dev/null 2>&1; then - if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then - echo "$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)is currently installed; replacing it" - HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall google-chrome >/dev/null 2>&1 || true - $SUDO rm -rf /Applications/Google\ Chrome.app >/dev/null 2>&1 || true - else - echo "$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)is already installed" - exit 0 - fi - else - echo "Google Chrome is not currently installed; installing it" - fi - elif grep Alpine /etc/issue >/dev/null 2>&1; then - if command -v chromium-browser >/dev/null 2>&1; then - if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then - echo "$(chromium-browser --version)is currently installed; replacing it" - $SUDO apk del --force-broken-world chromium >/dev/null 2>&1 || true - $SUDO rm -f "$(command -v chromium-browser)" >/dev/null 2>&1 || true - else - echo "$(chromium-browser --version)is already installed to $(command -v chromium-browser)" - exit 0 - fi - else - echo "Google Chrome (via Chromium) is not currently installed; installing it" - fi - elif command -v yum >/dev/null 2>&1; then - if command -v google-chrome >/dev/null 2>&1; then - if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then - echo "$(google-chrome --version)is currently installed; replacing it" - $SUDO yum remove -y google-chrome-stable >/dev/null 2>&1 || true - $SUDO rm -f "$(command -v google-chrome)" >/dev/null 2>&1 || true - else - echo "$(google-chrome --version)is already installed to $(command -v google-chrome)" - exit 0 - fi - else - echo "Google Chrome is not currently installed; installing it" - fi - else - if command -v google-chrome >/dev/null 2>&1; then - if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then - echo "$(google-chrome --version)is currently installed; replacing it" - $SUDO apt-get -y --purge remove google-chrome-stable >/dev/null 2>&1 || true - $SUDO rm -f "$(command -v google-chrome)" >/dev/null 2>&1 || true - else - echo "$(google-chrome --version)is already installed to $(command -v google-chrome)" - exit 0 - fi - else - echo "Google Chrome is not currently installed; installing it" - fi - fi - - # install chrome - if uname -a | grep Darwin >/dev/null 2>&1; then - echo "Preparing Chrome installation for MacOS-based systems" - # Universal MacOS .pkg with license pre-accepted: https://support.google.com/chrome/a/answer/9915669?hl=en - CHROME_MAC_URL="https://dl.google.com/chrome/mac/${ORB_PARAM_CHANNEL}/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg" - CHROME_TEMP_DIR="$(mktemp -d)" - curl -L -o "$CHROME_TEMP_DIR/googlechrome.pkg" "$CHROME_MAC_URL" - sudo /usr/sbin/installer -pkg "$CHROME_TEMP_DIR/googlechrome.pkg" -target / - sudo rm -rf "$CHROME_TEMP_DIR" - echo '#!/usr/bin/env bash' >> google-chrome-$ORB_PARAM_CHANNEL - if [[ $ORB_PARAM_CHANNEL == "beta" ]]; then - xattr -rc "/Applications/Google Chrome Beta.app" - echo '/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta "$@"' >> google-chrome-$ORB_PARAM_CHANNEL - else - xattr -rc "/Applications/Google Chrome.app" - echo '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "$@"' >> google-chrome-$ORB_PARAM_CHANNEL - fi - sudo mv google-chrome-$ORB_PARAM_CHANNEL /usr/local/bin/ - sudo chmod +x /usr/local/bin/google-chrome-$ORB_PARAM_CHANNEL - # test/verify installation - if google-chrome-$ORB_PARAM_CHANNEL --version >/dev/null 2>&1; then - echo "$(google-chrome-$ORB_PARAM_CHANNEL --version)has been installed in the /Applications directory" - echo "A shortcut has also been created at $(command -v google-chrome)" - exit 0 - else - echo "The latest release of Google Chrome (${ORB_PARAM_CHANNEL}) failed to install." - exit 1 - fi - elif command -v yum >/dev/null 2>&1; then - echo "Preparing Chrome installation for RedHat-based systems" - # download chrome - if [[ "$ORB_PARAM_CHROME_VERSION" == "latest" ]]; then - CHROME_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm" - else - CHROME_URL="https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-${ORB_PARAM_CHANNEL}-$ORB_PARAM_CHROME_VERSION-1.x86_64.rpm" - fi - curl --silent --show-error --location --fail --retry 3 \ - --output google-chrome.rpm \ - "$CHROME_URL" - curl --silent --show-error --location --fail --retry 3 \ - --output liberation-fonts.rpm \ - http://mirror.centos.org/centos/7/os/x86_64/Packages/liberation-fonts-1.07.2-16.el7.noarch.rpm - $SUDO yum localinstall -y liberation-fonts.rpm \ - >/dev/null 2>&1 - $SUDO yum localinstall -y google-chrome.rpm \ - >/dev/null 2>&1 - rm -rf google-chrome.rpm liberation-fonts.rpm - else - # download chrome - echo "Preparing Chrome installation for Debian-based systems" - if [[ "$ORB_PARAM_CHROME_VERSION" == "latest" ]]; then - ENV_IS_ARM=$(! dpkg --print-architecture | grep -q arm; echo $?) - wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | $SUDO apt-key add - - if [ "$ENV_IS_ARM" == "arm" ]; then - echo "Installing Chrome for ARM64" - $SUDO sh -c 'echo "deb [arch=arm64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' - else - echo "Installing Chrome for AMD64" - $SUDO sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' - fi - $SUDO apt-get update - DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y google-chrome-${ORB_PARAM_CHANNEL} - else - # Google does not keep older releases in their PPA, but they can be installed manually. HTTPS should be enough to secure the download. - wget --no-verbose -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${ORB_PARAM_CHROME_VERSION}-1_amd64.deb" \ - && $SUDO apt-get install -y /tmp/chrome.deb \ - && rm /tmp/chrome.deb - fi - fi - - # test/verify installation - if [[ "$ORB_PARAM_CHROME_VERSION" != "latest" ]]; then - if google-chrome-$ORB_PARAM_CHANNEL --version | grep "$ORB_PARAM_CHROME_VERSION" >/dev/null 2>&1; then - : - else - echo "Google Chrome v${ORB_PARAM_CHROME_VERSION} (${ORB_PARAM_CHANNEL}) failed to install." - exit 1 - fi - else - if google-chrome-$ORB_PARAM_CHANNEL --version >/dev/null 2>&1; then - : - else - echo "The latest release of Google Chrome (${ORB_PARAM_CHANNEL}) failed to install." - exit 1 - fi - echo "$(google-chrome-$ORB_PARAM_CHANNEL --version) has been installed to $(command -v google-chrome-$ORB_PARAM_CHANNEL)" - echo "Chrome: $ORB_PARAM_CHROME_VERSION" >>"${HOME}/.browser-versions" - fi - environment: - ORB_PARAM_CHANNEL: << parameters.channel >> - ORB_PARAM_CHROME_VERSION: <> - ORB_PARAM_REPLACE_EXISTING: <> - name: Install Google Chrome - install-chromedriver: - description: | - Install Google's ChromeDriver WebDriver proxy, for use in browser testing with Chrome. A ChromeDriver version will be dynamically selected based on the installed version of Chrome; for details, see https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection Requirements: sed, curl, unzip - parameters: - install-dir: - default: /usr/local/bin - description: | - Directory in which to install ChromeDriver (directory selection not supported on Alpine Linux) - type: string - steps: - - run: - command: "#!/bin/bash\nif [[ $EUID == 0 ]]; then export SUDO=\"\"; else export SUDO=\"sudo\"; fi\n# determine_chrome_version\nif uname -a | grep Darwin >/dev/null 2>&1; then\n echo \"System detected as MacOS\"\n\n if [ -f \"/usr/local/bin/google-chrome-stable\" ]; then\n CHROME_VERSION=\"$(/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version)\"\n else\n CHROME_VERSION=\"$(/Applications/Google\\ Chrome\\ Beta.app/Contents/MacOS/Google\\ Chrome\\ Beta --version)\"\n fi\n PLATFORM=mac64\n\nelif grep Alpine /etc/issue >/dev/null 2>&1; then\n apk update >/dev/null 2>&1 &&\n apk add --no-cache chromium-chromedriver >/dev/null\n\n # verify version\n echo \"$(chromedriver --version) has been installed to $(command -v chromedriver)\"\n\n exit 0\nelse\n CHROME_VERSION=\"$(google-chrome --version)\"\n PLATFORM=linux64\nfi\n\nCHROME_VERSION_STRING=\"$(echo \"$CHROME_VERSION\" | sed 's/.*Google Chrome //' | sed 's/.*Chromium //')\"\n\n# print Chrome version\necho \"Installed version of Google Chrome is $CHROME_VERSION_STRING\"\n\n# determine chromedriver release\nCHROMEDRIVER_RELEASE=\"${CHROME_VERSION_STRING%%.*}\"\n\nCHROME_RELEASE=\"${CHROMEDRIVER_RELEASE}\"\n\nif [[ $CHROME_RELEASE -lt 70 ]]; then\n # https://sites.google.com/a/chromium.org/chromedriver/downloads\n # https://chromedriver.storage.googleapis.com/2.40/notes.txt\n\n case $CHROME_RELEASE in\n 69)\n CHROMEDRIVER_VERSION=\"2.44\"\n ;;\n 68)\n CHROMEDRIVER_VERSION=\"2.42\"\n ;;\n 67)\n CHROMEDRIVER_VERSION=\"2.41\"\n ;;\n 66)\n CHROMEDRIVER_VERSION=\"2.40\"\n ;;\n 65)\n CHROMEDRIVER_VERSION=\"2.38\"\n ;;\n 64)\n CHROMEDRIVER_VERSION=\"2.37\"\n ;;\n 63)\n CHROMEDRIVER_VERSION=\"2.36\"\n ;;\n 62)\n CHROMEDRIVER_VERSION=\"2.35\"\n ;;\n 61)\n CHROMEDRIVER_VERSION=\"2.34\"\n ;;\n 60)\n CHROMEDRIVER_VERSION=\"2.33\"\n ;;\n 59)\n CHROMEDRIVER_VERSION=\"2.32\"\n ;;\n 58)\n CHROMEDRIVER_VERSION=\"2.31\"\n ;;\n 57)\n CHROMEDRIVER_VERSION=\"2.29\"\n ;;\n 56)\n CHROMEDRIVER_VERSION=\"2.29\"\n ;;\n 55)\n CHROMEDRIVER_VERSION=\"2.28\"\n ;;\n 54)\n CHROMEDRIVER_VERSION=\"2.27\"\n ;;\n 53)\n CHROMEDRIVER_VERSION=\"2.26\"\n ;;\n 52)\n CHROMEDRIVER_VERSION=\"2.24\"\n ;;\n 51)\n CHROMEDRIVER_VERSION=\"2.23\"\n ;;\n 50)\n CHROMEDRIVER_VERSION=\"2.22\"\n ;;\n 49)\n CHROMEDRIVER_VERSION=\"2.22\"\n ;;\n 48)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 47)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 46)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 45)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n 44)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n 43)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n *)\n echo \"Sorry, Google Chrome/Chromium version 43 or newer is required to use ChromeDriver\"\n exit 1\n ;;\n esac\n elif [[ $CHROME_RELEASE -lt 115 ]]; then\n CHROMEDRIVER_VERSION=$(curl --silent --show-error --location --fail --retry 3 \\\n \"https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEDRIVER_RELEASE\")\n else\n # shellcheck disable=SC2001\n CHROMEDRIVER_VERSION=$(echo $CHROME_VERSION | sed 's/[^0-9.]//g')\nfi\n\n# installation check\nif command -v chromedriver >/dev/null 2>&1; then\n if chromedriver --version | grep \"$CHROMEDRIVER_VERSION\" >/dev/null 2>&1; then\n echo \"ChromeDriver $CHROMEDRIVER_VERSION is already installed\"\n exit 0\n else\n echo \"A different version of ChromeDriver is installed ($(chromedriver --version)); removing it\"\n $SUDO rm -f \"$(command -v chromedriver)\"\n fi\nfi\n\necho \"ChromeDriver $CHROMEDRIVER_VERSION will be installed\"\n\n# download chromedriver\nif [[ $CHROME_RELEASE -lt 115 ]]; then\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_$PLATFORM.zip\"\nelse \n echo \"$CHROMEDRIVER_VERSION will be installed\"\n if [[ $PLATFORM == \"linux64\" ]]; then\n PLATFORM=\"linux64\"\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip\"\n elif [[ $PLATFORM == \"mac64\" ]]; then\n PLATFORM=\"mac-x64\"\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/mac-x64/chromedriver-mac-x64.zip\"\n else\n PLATFORM=\"win64\"\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/win64/chromedriver-win64.zip\"\n fi\nfi\n\n# setup chromedriver installation\nif command -v yum >/dev/null 2>&1; then\n yum install -y unzip >/dev/null 2>&1\nfi\n\nunzip \"chromedriver_$PLATFORM.zip\" >/dev/null 2>&1\nrm -rf \"chromedriver_$PLATFORM.zip\"\n\nif [[ $CHROME_RELEASE -gt 114 ]]; then\n mv \"chromedriver-$PLATFORM\" chromedriver\n $SUDO mv chromedriver/chromedriver \"$ORB_PARAM_DRIVER_INSTALL_DIR\"\n rm -rf \"chromedriver\"\nelse\n $SUDO mv chromedriver \"$ORB_PARAM_DRIVER_INSTALL_DIR\"\nfi\n\n\n$SUDO chmod +x \"$ORB_PARAM_DRIVER_INSTALL_DIR/chromedriver\" \n\n\n# test/verify version\n if chromedriver --version | grep \"$CHROMEDRIVER_VERSION\" >/dev/null 2>&1; then\n echo \"$(chromedriver --version) has been installed to $(command -v chromedriver)\"\n readonly base_dir=\"${CIRCLE_WORKING_DIRECTORY/\\~/$HOME}\"\n rm -f \"${base_dir}/LICENSE.chromedriver\"\n else\n echo \"Something went wrong; ChromeDriver could not be installed\"\n exit 1\n fi\n" - environment: - ORB_PARAM_DRIVER_INSTALL_DIR: <> - name: Install ChromeDriver - install-firefox: - description: | - Install Mozilla's Firefox browser, for use in browser testing. Requires apt-get, gpg, curl, sha256sum, tar, jq - parameters: - install-dir: - default: /usr/local/bin - description: | - Directory in which to install Firefox - type: string - version: - default: latest - description: | - Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, ESR or otherwise, e.g., 66.0.3, 52.0.1esr, 53.0, etc. - type: string - steps: - - run: - command: | - #!/bin/bash - if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi - # FUNCTIONS - grab_firefox_version() { - if [[ "$ORB_PARAM_FIREFOX_VERSION" == "latest" ]]; then - # extract latest version from mozilla product details API - - FIREFOX_VERSION_STRING=$(curl \ - https://product-details.mozilla.org/1.0/firefox_versions.json | - jq '.LATEST_FIREFOX_VERSION') - - # strip leading/trailing " - temp="${FIREFOX_VERSION_STRING%\"}" - FIREFOX_VERSION="${temp#\"}" - echo "Latest stable version of Firefox is $FIREFOX_VERSION" - else - FIREFOX_VERSION="$ORB_PARAM_FIREFOX_VERSION" - echo "Selected version of Firefox is $FIREFOX_VERSION" - fi - - # create Firefox download URL base - FIREFOX_URL_BASE="https://archive.mozilla.org/pub/firefox/releases/$FIREFOX_VERSION" - } - - installation_check() { - if command -v firefox >/dev/null 2>&1; then - if firefox --version | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then - echo "firefox $FIREFOX_VERSION is already installed" - exit 0 - else - echo "A different version of Firefox is installed ($(firefox --version)); removing it" - $SUDO rm -f "$(command -v firefox)" - fi - fi - } - - # mac: setup version, install packages, then continue - if uname -a | grep Darwin >/dev/null 2>&1; then - echo "System detected as MacOS" - grab_firefox_version - installation_check - HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg coreutils >/dev/null 2>&1 - # deb/ubuntu/other linux: setup version, install packages, then continue - else - echo "System detected as Linux" - grab_firefox_version - installation_check - - if command -v yum >/dev/null 2>&1; then - $SUDO yum install -y \ - alsa-lib \ - bzip2 \ - dbus-glib-devel \ - gtk2-devel \ - gtk3-devel \ - libXt-devel \ - perl \ - which \ - >/dev/null 2>&1 - else - $SUDO apt-get update >/dev/null 2>&1 && - $SUDO apt-get install -y \ - libasound-dev \ - libxt6 \ - libgtk-3-dev \ - libdbus-glib-1-2 \ - >/dev/null 2>&1 - fi - fi - - # import public key - curl --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/KEY" | gpg --import >/dev/null 2>&1 - - # download shasums - curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA256SUMS.asc" || curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA512SUMS.asc" - curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA256SUMS" || curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA512SUMS" - - # verify shasums - gpg --verify SHA256SUMS.asc SHA256SUMS || gpg --verify SHA512SUMS.asc SHA512SUMS - rm -f SHA256SUMS.asc || rm -f SHA512SUMS.asc - - # setup firefox download - if uname -a | grep Darwin >/dev/null 2>&1; then - FIREFOX_FILE="Firefox%20$FIREFOX_VERSION" - PLATFORM=mac - FILE_EXT=dmg - else - FIREFOX_FILE="firefox-$FIREFOX_VERSION" - PLATFORM=linux-x86_64 - FILE_EXT=tar.bz2 - fi - - FIREFOX_FILE_LOCATION="$PLATFORM/en-US/$FIREFOX_FILE" - - FIREFOX_FILE_NAME="$PLATFORM-en-US-$FIREFOX_FILE" - - # download firefox - curl --silent --show-error --location --fail --retry 3 \ - --output "$FIREFOX_FILE_NAME.$FILE_EXT" \ - "$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT" - - if uname -a | grep Darwin >/dev/null 2>&1; then - echo "No PGP data for macOS Firefox releases; skipping PGP verification" - - perl -i -pe "s&mac/en-US/Firefox $FIREFOX_VERSION&mac-en-US-Firefox%20$FIREFOX_VERSION&g" SHA256SUMS - perl -i -pe "s&mac/en-US/Firefox $FIREFOX_VERSION&mac-en-US-Firefox%20$FIREFOX_VERSION&g" SHA512SUMS - else - # only do this step if .asc file exists for this version - if [[ $(curl --silent --location --fail --retry 3 \ - "$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT.asc") ]]; then - - curl --silent --show-error --location --fail --retry 3 \ - --output "$FIREFOX_FILE_NAME.$FILE_EXT.asc" \ - "$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT.asc" - - # verify download archive - gpg --verify "$FIREFOX_FILE_NAME.$FILE_EXT.asc" "$FIREFOX_FILE_NAME.$FILE_EXT" - rm -f "$FIREFOX_FILE_NAME.$FILE_EXT.asc" - fi - - perl -i -pe "s%linux-x86_64/en-US/firefox%linux-x86_64-en-US-firefox%g" SHA256SUMS - perl -i -pe "s%linux-x86_64/en-US/firefox%linux-x86_64-en-US-firefox%g" SHA512SUMS - fi - - grep "$FIREFOX_FILE_NAME.$FILE_EXT" SHA256SUMS | sha256sum -c - || - grep "$FIREFOX_FILE_NAME.$FILE_EXT" SHA512SUMS | sha512sum -c - - rm -f SHA256SUMS || rm -f SHA512SUMS - - # setup firefox installation - if uname -a | grep Darwin >/dev/null 2>&1; then - hdiutil attach "$FIREFOX_FILE_NAME.$FILE_EXT" >/dev/null 2>&1 - $SUDO cp -R /Volumes/Firefox/Firefox.app /Applications - - hdiutil eject /Volumes/Firefox >/dev/null 2>&1 - $SUDO rm -f "$FIREFOX_FILE_NAME.$FILE_EXT" - - echo -e "#\!/bin/bash\n" >firefox - perl -i -pe "s|#\\\|#|g" firefox - echo -e "/Applications/Firefox.app/Contents/MacOS/firefox \"\$@\"" >>firefox - - $SUDO mv firefox "$ORB_PARAM_FIREFOX_INSTALL_DIR" - $SUDO chmod +x "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox" - - # test/verify version - if firefox --version | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then - echo "$(firefox --version) has been installed in the /Applications directory" - echo "A shortcut has also been created at $(command -v firefox)" - else - echo "Something went wrong; the specified version of Firefox could not be installed" - exit 1 - fi - - else - $SUDO tar -xjf "$FIREFOX_FILE_NAME.$FILE_EXT" - $SUDO rm -f "$FIREFOX_FILE_NAME.$FILE_EXT" - $SUDO mv firefox "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION" - $SUDO chmod +x "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION/firefox" - $SUDO ln -s "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION/firefox" /usr/local/bin/firefox - - # test/verify version - if echo "$(firefox --version)esr" | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then - echo "$(firefox --version) has been installed to $(command -v firefox)" - else - echo "Something went wrong; the specified version of Firefox could not be installed" - exit 1 - fi - fi - environment: - ORB_PARAM_FIREFOX_INSTALL_DIR: <> - ORB_PARAM_FIREFOX_VERSION: <> - name: Install Firefox - install-geckodriver: - description: | - Install Mozilla's Geckodriver WebDriver proxy, for use in browser testing with Firefox. Requirements: curl, tar - parameters: - install-dir: - default: /usr/local/bin - description: | - Directory in which to install Geckodriver - type: string - version: - default: latest - description: | - Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html - type: string - steps: - - run: - command: | - #!/bin/bash - if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi - # FUNCTIONS - grab_geckodriver_version() { - if [[ "$ORB_PARAM_GECKO_VERSION" == "latest" ]]; then - # extract latest version from github releases API - GECKODRIVER_VERSION_STRING=$(curl -Ls -o /dev/null -w "%{url_effective}\n" "https://github.com/mozilla/geckodriver/releases/latest" | sed 's:.*/::') - - # strip leading/trailing " - temp="${GECKODRIVER_VERSION_STRING%\"}" - GECKODRIVER_VERSION="${temp#\"}" - else - GECKODRIVER_VERSION="$ORB_PARAM_GECKO_VERSION" - fi - - echo "Selected version of Geckodriver is: $GECKODRIVER_VERSION" - } - - installation_check() { - if command -v geckodriver >>/dev/null 2>&1; then - if geckodriver --version | grep "$GECKODRIVER_VERSION" >>/dev/null 2>&1; then - echo "Geckodriver $GECKODRIVER_VERSION is already installed" - exit 0 - else - echo "A different version of Geckodriver is installed ($(geckodriver --version)); removing it" - $SUDO rm -rf "$(command -v geckodriver)" - fi - else - echo "Geckodriver is not currently installed; installing it" - fi - } - - grab_geckodriver_version - installation_check - - if uname -a | grep Darwin >>/dev/null 2>&1; then - PLATFORM=macos - else - PLATFORM=linux64 - fi - - # get download URL - GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" - - # download geckodriver - $SUDO curl --silent --show-error --location --fail --retry 3 --output "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" "$GECKODRIVER_URL" - - # setup geckodriver installation - $SUDO tar xf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" - $SUDO rm -rf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" - - $SUDO mv geckodriver "$ORB_PARAM_GECKO_INSTALL_DIR" - $SUDO chmod +x "$ORB_PARAM_GECKO_INSTALL_DIR/geckodriver" - - # verify version - echo "Geckodriver has been installed to $(command -v geckodriver)" - geckodriver --version - - # test/verify version - - GECKODRIVER_VERSION_NUM="$(echo "$GECKODRIVER_VERSION" | sed -E 's/v//')" - - if geckodriver --version | grep "$GECKODRIVER_VERSION_NUM" >/dev/null 2>&1; then - echo "$(geckodriver --version) has been installed to $(command -v geckodriver)" - else - echo "Something went wrong; the specified version of Geckodriver could not be installed" - exit 1 - fi - environment: - ORB_PARAM_GECKO_INSTALL_DIR: <> - ORB_PARAM_GECKO_VERSION: <> - name: Install Geckodriver +# VS Code Extension Version: 1.5.1 From c27442bc1336c08ee7eb9b0b748f7834ba0ba300 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 18:20:14 +0200 Subject: [PATCH 09/21] custom script --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 07a497481b..4a04c17036 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,7 @@ jobs: xlarge working_directory: ~/remix-project steps: + - install-chromedriver-custom-linux - checkout - restore_cache: keys: @@ -367,3 +368,12 @@ workflows: only: remix_beta # VS Code Extension Version: 1.5.1 +commands: + install-chromedriver-custom-linux: + description: Custom script to install chromedriver with better version support for linux + steps: + - run: + command: > + #!/bin/bash + curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json' | python3 -c "import sys, json; print(json.load(sys.stdin)['channels']['Stable']['version'])" + From 321426878453f4e6bb14a5954979cd0d81eba9ba Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 18:26:29 +0200 Subject: [PATCH 10/21] echo version --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a04c17036..f58286de1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -375,5 +375,5 @@ commands: - run: command: > #!/bin/bash - curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json' | python3 -c "import sys, json; print(json.load(sys.stdin)['channels']['Stable']['version'])" - + CHROMEDRIVER_VERSION=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json' | python3 -c "import sys, json; print(json.load(sys.stdin)['channels']['Stable']['version'])") + echo $CHROMEDRIVER_VERSION From 6d84e045b7f61029a7aa8c4d8abbb70264b31d15 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 18:53:39 +0200 Subject: [PATCH 11/21] output --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f58286de1c..bd4003b152 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -373,7 +373,6 @@ commands: description: Custom script to install chromedriver with better version support for linux steps: - run: - command: > - #!/bin/bash + command: | CHROMEDRIVER_VERSION=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json' | python3 -c "import sys, json; print(json.load(sys.stdin)['channels']['Stable']['version'])") echo $CHROMEDRIVER_VERSION From f438e6bc45d6404c18ea11dcce29158e7a22793f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 19:12:23 +0200 Subject: [PATCH 12/21] get url --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd4003b152..ab9d07b5bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -374,5 +374,5 @@ commands: steps: - run: command: | - CHROMEDRIVER_VERSION=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json' | python3 -c "import sys, json; print(json.load(sys.stdin)['channels']['Stable']['version'])") - echo $CHROMEDRIVER_VERSION + CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url') + echo $CHROMEDRIVER_URL From 95ee81bfd6b322e1f89fc725a5c93f5e37d37477 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 19:21:52 +0200 Subject: [PATCH 13/21] install --- .circleci/config.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab9d07b5bf..6e286e50b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -376,3 +376,22 @@ commands: command: | CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url') echo $CHROMEDRIVER_URL + ZIPFILEPATH="/tmp/chromedriver.zip" + echo "Downloading from $CHROMEDRIVER_URL" + curl -f --silent $CHROMEDRIVER_URL > "$ZIPFILEPATH" + + BINFILEPATH="$HOME/bin/chromedriver-$VERSION" + echo "Extracting to $BINFILEPATH" + unzip -p "$ZIPFILEPATH" chromedriver > "$BINFILEPATH" + + echo Setting execute flag + chmod +x "$BINFILEPATH" + + echo Updating symlink + ln -nfs "$BINFILEPATH" ~/bin/chromedriver + + echo Removing ZIP file + rm "$ZIPFILEPATH" + + echo Done + chromedriver -v From b8a5c2de0f4219310ad03d19258f72b7cb3bca25 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:29:54 +0200 Subject: [PATCH 14/21] fix --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e286e50b1..caed35cb8c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -380,7 +380,7 @@ commands: echo "Downloading from $CHROMEDRIVER_URL" curl -f --silent $CHROMEDRIVER_URL > "$ZIPFILEPATH" - BINFILEPATH="$HOME/bin/chromedriver-$VERSION" + BINFILEPATH="$HOME/bin/chromedriver-linux" echo "Extracting to $BINFILEPATH" unzip -p "$ZIPFILEPATH" chromedriver > "$BINFILEPATH" From d77e4f44e6842396beb5243d572f91c4c1507bb5 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:33:45 +0200 Subject: [PATCH 15/21] fix --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index caed35cb8c..1a3d043d47 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -374,7 +374,7 @@ commands: steps: - run: command: | - CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url') + CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url' | tr -d '"') echo $CHROMEDRIVER_URL ZIPFILEPATH="/tmp/chromedriver.zip" echo "Downloading from $CHROMEDRIVER_URL" From 90e199d0101ffa68fc72cd8a6d5918d166964a00 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:35:10 +0200 Subject: [PATCH 16/21] filename --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a3d043d47..eecd217498 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -382,7 +382,7 @@ commands: BINFILEPATH="$HOME/bin/chromedriver-linux" echo "Extracting to $BINFILEPATH" - unzip -p "$ZIPFILEPATH" chromedriver > "$BINFILEPATH" + unzip -p "$ZIPFILEPATH" chromedriver-linux64/chromedriver > "$BINFILEPATH" echo Setting execute flag chmod +x "$BINFILEPATH" From 11ddb734f3eac0338c8f2b877828fbfd869aa11a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:37:04 +0200 Subject: [PATCH 17/21] use script --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eecd217498..6667c42ca9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,6 @@ jobs: xlarge working_directory: ~/remix-project steps: - - install-chromedriver-custom-linux - checkout - restore_cache: keys: @@ -147,6 +146,7 @@ jobs: install-chrome: true install-chromedriver: false install-geckodriver: false + - install-chromedriver-custom-linux - run: google-chrome --version - run: chromedriver --version - run: rm LICENSE.chromedriver 2> /dev/null || true @@ -204,6 +204,7 @@ jobs: install-chrome: true install-geckodriver: false install-chromedriver: false + - install-chromedriver-custom-linux - run: google-chrome --version - run: chromedriver --version - run: rm LICENSE.chromedriver 2> /dev/null || true From 2d0b474006550d20a715b07fd894aaea5e9f193c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:42:28 +0200 Subject: [PATCH 18/21] hide commands --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6667c42ca9..d03ca6a406 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -374,7 +374,7 @@ commands: description: Custom script to install chromedriver with better version support for linux steps: - run: - command: | + command: > CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url' | tr -d '"') echo $CHROMEDRIVER_URL ZIPFILEPATH="/tmp/chromedriver.zip" From d54bf717ca0a23f7bdb262178221d7356e7f3210 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:42:53 +0200 Subject: [PATCH 19/21] show command --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d03ca6a406..053baa78b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,7 @@ jobs: xlarge working_directory: ~/remix-project steps: + - install-chromedriver-custom-linux - checkout - restore_cache: keys: From ab6739647a12797d5566ca73d4ff513f676ba07c Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:44:50 +0200 Subject: [PATCH 20/21] name it --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 053baa78b4..2127006732 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -375,7 +375,8 @@ commands: description: Custom script to install chromedriver with better version support for linux steps: - run: - command: > + name: install-chromedriver-custom-linux + command: | CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url' | tr -d '"') echo $CHROMEDRIVER_URL ZIPFILEPATH="/tmp/chromedriver.zip" From 48da050c9033df4ccf626a37e281ddfef5bf8904 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 30 Aug 2023 22:45:41 +0200 Subject: [PATCH 21/21] rm from build --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2127006732..d5717a7e1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,6 @@ jobs: xlarge working_directory: ~/remix-project steps: - - install-chromedriver-custom-linux - checkout - restore_cache: keys: