Skip to content

Commit

Permalink
feat: adds browser install for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
kukkok3 committed Apr 16, 2024
1 parent 8cbf3e3 commit 1484428
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 46 deletions.
4 changes: 2 additions & 2 deletions catalyst_voices/Earthfile
Expand Up @@ -12,8 +12,8 @@ deps:
RUN apt-get install -y git curl unzip bzip2 bash jq gpg
COPY --dir test_driver/scripts .
RUN chmod +x scripts/install-chrome-linux64.sh && ./scripts/install-chrome-linux64.sh
#RUN chmod +x scripts/install-edge-linux64.sh && ./scripts/install-edge-linux64.sh
#RUN chmod +x scripts/install-firefox-linux64.sh && ./scripts/install-firefox-linux64.sh
RUN chmod +x scripts/install-edge-linux64.sh && ./scripts/install-edge-linux64.sh
RUN chmod +x scripts/install-firefox-linux64.sh && ./scripts/install-firefox-linux64.sh

WORKDIR /frontend

Expand Down
77 changes: 41 additions & 36 deletions catalyst_voices/test_driver/scripts/install-chrome-linux64.sh
@@ -1,42 +1,47 @@
#!/bin/bash
# This script installs Chrome for testing and Chromedriver
echo "TARGET ARCHITECTURE $TARGETARCH"
if [ "$TARGETARCH" == "amd64" ]
# This script installs Chrome/Chromium for testing and Chromedriver
if [ "$TARGETARCH" == "arm64"]
# There is no Chrome for testing for arm64, using chromium instead
# https://github.com/GoogleChromeLabs/chrome-for-testing/issues/1
then
PLATFORM=linux64
else
PLATFORM=mac-arm64
fi

DISTR="Debian 12 (Bookworm)"
echo -e "\033[1;34mInstalling Chromium..."
apt-get update
apt-get install -y chromium
ln -s /usr/bin/chromium /usr/local/bin/google-chrome
google-chrome --version

# Installing dependencies for Chrome. Workaround for:
# https://github.com/GoogleChromeLabs/chrome-for-testing/issues/55
echo -e "\033[1;34mInstalling Google Chrome dependencies for $PLATFORM"
chrome_deps=$(curl -s https://raw.githubusercontent.com/chromium/chromium/main/chrome/installer/linux/debian/dist_package_versions.json)
deps=$(echo "$chrome_deps" | jq -r ".\"$DISTR\" | keys[]")
apt-get update
for dep in $deps; do
apt-get install -y $dep
done
apt-get install chromium-driver
chromedriver --version
else
DISTR="Debian 12 (Bookworm)"
# Installing dependencies for Chrome. Workaround for:
# https://github.com/GoogleChromeLabs/chrome-for-testing/issues/55
echo -e "\033[1;34mInstalling Google Chrome dependencies..."
chrome_deps=$(curl -s https://raw.githubusercontent.com/chromium/chromium/main/chrome/installer/linux/debian/dist_package_versions.json)
deps=$(echo "$chrome_deps" | jq -r ".\"$DISTR\" | keys[]")
apt-get update
for dep in $deps; do
apt-get install -y $dep
done

# Get latest chrome for testing version
json_chrome=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json)
# Get latest chrome for testing version
json_chrome=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json)

# Install chrome
echo -e "\033[1;34mInstalling Google Chrome..."
latest_chrome=$(echo "$json_chrome" | jq -r ".channels.Stable.downloads.chrome[].url | select(contains(\"$PLATFORM\"))")
curl -s --create-dirs -o chrome.zip --output-dir /opt/chrome "$latest_chrome"
unzip -d /opt/chrome -j /opt/chrome/chrome.zip && rm /opt/chrome/chrome.zip
ln -s /opt/chrome/chrome /usr/local/bin/google-chrome
chmod +x /opt/chrome/chrome
google-chrome --version
# Install chrome
echo -e "\033[1;34mInstalling Google Chrome..."
latest_chrome=$(echo "$json_chrome" | jq -r ".channels.Stable.downloads.chrome[].url | select(contains(\"linux64\"))")
curl -s --create-dirs -o chrome.zip --output-dir /opt/chrome "$latest_chrome"
unzip -d /opt/chrome -j /opt/chrome/chrome.zip && rm /opt/chrome/chrome.zip
ln -s /opt/chrome/chrome /usr/local/bin/google-chrome
chmod +x /opt/chrome/chrome
google-chrome --version

# Install chromedriver
echo -e "\033[1;34mInstalling Chromedriver..."
latest_chromedriver=$(echo "$json_chrome" | jq -r ".channels.Stable.downloads.chromedriver[].url | select(contains(\"$PLATFORM\"))")
curl -s --create-dirs -o chromedriver.zip --output-dir /opt/chromedriver "$latest_chromedriver"
unzip -d /opt/chromedriver -j /opt/chromedriver/chromedriver.zip && rm /opt/chromedriver/chromedriver.zip
ln -s /opt/chromedriver/chromedriver /usr/local/bin/chromedriver
chmod +x /opt/chromedriver/chromedriver
chromedriver --version
# Install chromedriver
echo -e "\033[1;34mInstalling Chromedriver..."
latest_chromedriver=$(echo "$json_chrome" | jq -r ".channels.Stable.downloads.chromedriver[].url | select(contains(\"linux64\"))")
curl -s --create-dirs -o chromedriver.zip --output-dir /opt/chromedriver "$latest_chromedriver"
unzip -d /opt/chromedriver -j /opt/chromedriver/chromedriver.zip && rm /opt/chromedriver/chromedriver.zip
ln -s /opt/chromedriver/chromedriver /usr/local/bin/chromedriver
chmod +x /opt/chromedriver/chromedriver
chromedriver --version
fi
12 changes: 8 additions & 4 deletions catalyst_voices/test_driver/scripts/install-edge-linux64.sh
@@ -1,15 +1,19 @@
#!/bin/bash
# This script installs Edge and Edgedriver.
PLATFORM=linux64

echo "Installing Edge..."
if [ "$TARGETARCH" == "arm64"]
then
PLATFORM=arm64
else
PLATFORM=linux64
fi
echo -e "\033[1;34mInstalling Edge..."
install -d -m 0755 /etc/apt/keyrings
curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/keyrings/microsoft-edge.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/keyrings/microsoft-edge.gpg] https://packages.microsoft.com/repos/edge stable main' | tee /etc/apt/sources.list.d/microsoft-edge.list
apt-get update && apt-get install -y microsoft-edge-stable
microsoft-edge-stable --version

echo "Installing Edgedriver..."
echo -e "\033[1;34mInstalling Edgedriver..."
edge_version=$(microsoft-edge-stable --version | grep -Eo '[0-9]+.+' | tr -d ' ')
curl -s --create-dirs -o msedgedriver.zip --output-dir /opt/msedgedriver "https://msedgedriver.azureedge.net/$edge_version/edgedriver_$PLATFORM.zip"
unzip -d /opt/msedgedriver -j /opt/msedgedriver/msedgedriver.zip && rm /opt/msedgedriver/msedgedriver.zip
Expand Down
12 changes: 8 additions & 4 deletions catalyst_voices/test_driver/scripts/install-firefox-linux64.sh
@@ -1,9 +1,13 @@
#!/bin/bash
# This script installs Firefox and Geckodriver. Geckodriver supported versions:
# https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
PLATFORM=linux64

echo "Installing Firefox..."
if [ "$TARGETARCH" == "arm64"]
then
PLATFORM=aarch64
else
PLATFORM=linux64
fi
echo -e "\033[1;34mInstalling Firefox..."
install -d -m 0755 /etc/apt/keyrings
curl -fSsL https://packages.mozilla.org/apt/repo-signing-key.gpg | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
Expand All @@ -15,7 +19,7 @@ Pin-Priority: 1000
apt-get update && apt-get install -y firefox
firefox --version

echo "Installing Geckodriver..."
echo -e "\033[1;34mInstalling Geckodriver..."
json_geckodriver=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
latest_geckodriver=$(echo "$json_geckodriver" | jq -r ".assets[].browser_download_url | select(contains(\"$PLATFORM\") and endswith(\"gz\"))")
curl -sL --create-dirs -o geckodriver.tar.gz --output-dir /opt/geckodriver "$latest_geckodriver"
Expand Down

0 comments on commit 1484428

Please sign in to comment.