From b1049584730e584b1255d34fb225e03935a7c9d0 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Thu, 10 Jun 2021 09:39:10 -0500 Subject: [PATCH 1/3] Add option to pin to a specific version of Chrome/ChromeDriver. Pin to v90 until v91 bugs are fixed --- .github/workflows/build.yml | 38 ++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2e8b9fe5e..f04db98e1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,9 @@ jobs: DSPACE_REST_PORT: 8080 DSPACE_REST_NAMESPACE: '/server' DSPACE_REST_SSL: false + # When Chrome version is specified, we pin to a specific version of Chrome & ChromeDriver + # Comment this out to use the latest release of both. + CHROME_VERSION: "90.0.4430.212-1" strategy: # Create a matrix of Node versions to test against (in parallel) matrix: @@ -34,10 +37,20 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Install latest Chrome (for e2e tests) + # If CHROME_VERSION env variable specified above, then pin to that version. + # Otherwise, just install latest version of Chrome. + - name: Install Chrome (for e2e tests) run: | - sudo apt-get update - sudo apt-get --only-upgrade install google-chrome-stable -y + if [[ -z "${CHROME_VERSION}" ]] + then + echo "Installing latest stable version" + sudo apt-get update + sudo apt-get --only-upgrade install google-chrome-stable -y + else + echo "Installing version ${CHROME_VERSION}" + wget -q "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb" + sudo dpkg -i "google-chrome-stable_${CHROME_VERSION}_amd64.deb" + fi google-chrome --version # https://github.com/actions/cache/blob/main/examples.md#node---yarn @@ -53,8 +66,23 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn- - - name: Install the latest chromedriver compatible with the installed chrome version - run: yarn global add chromedriver --detect_chromedriver_version + # If CHROME_VERSION env variable specified above, determine the corresponding latest ChromeDriver version + # and install it manually (we must install manually as it seems to be the only way to downgrade). + # Otherwise use "detect" flag to install based on installed Chrome version. + - name: Install ChromeDriver compatible with installed Chrome + run: | + if [[ -z "${CHROME_VERSION}" ]] + then + echo "Installing version based on Chrome" + yarn global add chromedriver --detect_chromedriver_version + else + latest_version_string="LATEST_RELEASE_$(echo $CHROME_VERSION | cut -d'.' -f1)" + version=$(curl -s "https://chromedriver.storage.googleapis.com/${latest_version_string}") + echo "Installing ${latest_version_string} (${version})" + wget -qP /tmp/ "https://chromedriver.storage.googleapis.com/${version}/chromedriver_linux64.zip" + sudo unzip -o /tmp/chromedriver_linux64.zip -d /usr/bin + fi + chromedriver -v - name: Install Yarn dependencies run: yarn install --frozen-lockfile From 326bffae7f09d11904241bc7a94136f865cc618f Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Fri, 11 Jun 2021 09:38:04 +0200 Subject: [PATCH 2/3] switch chromedriver to npm --- .github/workflows/build.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f04db98e1e..02cc590028 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,23 +66,9 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn- - # If CHROME_VERSION env variable specified above, determine the corresponding latest ChromeDriver version - # and install it manually (we must install manually as it seems to be the only way to downgrade). - # Otherwise use "detect" flag to install based on installed Chrome version. - - name: Install ChromeDriver compatible with installed Chrome - run: | - if [[ -z "${CHROME_VERSION}" ]] - then - echo "Installing version based on Chrome" - yarn global add chromedriver --detect_chromedriver_version - else - latest_version_string="LATEST_RELEASE_$(echo $CHROME_VERSION | cut -d'.' -f1)" - version=$(curl -s "https://chromedriver.storage.googleapis.com/${latest_version_string}") - echo "Installing ${latest_version_string} (${version})" - wget -qP /tmp/ "https://chromedriver.storage.googleapis.com/${version}/chromedriver_linux64.zip" - sudo unzip -o /tmp/chromedriver_linux64.zip -d /usr/bin - fi - chromedriver -v + - name: Install the latest chromedriver compatible with the installed chrome version + # needs to be npm, the --detect_chromedriver_version flag doesn't work with yarn global + run: npm install -g chromedriver --detect_chromedriver_version - name: Install Yarn dependencies run: yarn install --frozen-lockfile From e7282bdbd7ace08d212ef47868f6ffa0d10af2d7 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 11 Jun 2021 08:46:17 -0500 Subject: [PATCH 3/3] Minor cleanup, print chromedriver version after installation --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02cc590028..c856e8f5fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,9 +66,11 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: ${{ runner.os }}-yarn- - - name: Install the latest chromedriver compatible with the installed chrome version + - name: Install latest ChromeDriver compatible with installed Chrome # needs to be npm, the --detect_chromedriver_version flag doesn't work with yarn global - run: npm install -g chromedriver --detect_chromedriver_version + run: | + npm install -g chromedriver --detect_chromedriver_version + chromedriver -v - name: Install Yarn dependencies run: yarn install --frozen-lockfile