Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: browser installers #428

Merged
merged 8 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ jormungandr
Jörmungandr
junitreport
Keyhash
keyserver
lcov
Leshiy
libapp
libavcodec
libflutter
lintfix
localizable
Expand Down
1 change: 1 addition & 0 deletions catalyst_voices/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ VERSION --try --global-cache --arg-scope-and-set 0.7
# subcommand.
deps:
FROM debian:bookworm-slim
ARG TARGETARCH
RUN apt-get update
RUN apt-get install -y git curl unzip bzip2 bash jq gpg lcov
COPY --dir test_driver/scripts .
Expand Down
3 changes: 2 additions & 1 deletion catalyst_voices/test_driver/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ VERSION --try --global-cache --arg-scope-and-set 0.7

integration-test-web:
FROM ../+build
ARG TARGETARCH
ARG browser
LET driver_port = 4444

Expand All @@ -15,7 +16,7 @@ integration-test-web:
# Commenting out Edge tests as they are failing due to:
# https://github.com/flutter/flutter/issues/76213
# https://github.com/flutter/flutter/issues/142021
#IF [ $browser = "edge" ]
#IF [ $browser = "edge" && $TARGETARCH = "amd64" ]]
# LET driver = "msedgedriver"
#END
RUN ($driver --port=$driver_port > $driver.log &) && \
Expand Down
77 changes: 44 additions & 33 deletions catalyst_voices/test_driver/scripts/install-chrome-linux64.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
#!/bin/bash
# This script installs Chrome for testing and Chromedriver
PLATFORM=linux64
DISTR="Debian 12 (Bookworm)"
# This script installs Chrome/Chromium for testing and Chromedriver
# There is no Chrome-for-testing build for linux/arm64, using Chromium instead
# https://github.com/GoogleChromeLabs/chrome-for-testing/issues/1

# Installing dependencies for Chrome. Workaround for:
# https://github.com/GoogleChromeLabs/chrome-for-testing/issues/55
echo "Installing 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)

# Install chrome
echo "Installing 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 chromedriver
echo "Installing 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
if [ "$TARGETARCH" == "amd64" ]
then
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)
# 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(\"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
else
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

echo -e "\033[1;34mInstalling Chromedriver..."
apt-get install chromium-driver
chromedriver --version
fi
32 changes: 18 additions & 14 deletions catalyst_voices/test_driver/scripts/install-edge-linux64.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#!/bin/bash
# This script installs Edge and Edgedriver.
PLATFORM=linux64
# There is no Edge version build for linux/arm64, installing only for amd64
# https://github.com/MicrosoftEdge/Status/issues/697

echo "Installing 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
if [ "$TARGETARCH" == "amd64" ]
then
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..."
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
ln -s /opt/msedgedriver/msedgedriver /usr/local/bin/msedgedriver
chmod +x /opt/msedgedriver/msedgedriver
msedgedriver --version
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_linux64.zip"
unzip -d /opt/msedgedriver -j /opt/msedgedriver/msedgedriver.zip && rm /opt/msedgedriver/msedgedriver.zip
ln -s /opt/msedgedriver/msedgedriver /usr/local/bin/msedgedriver
chmod +x /opt/msedgedriver/msedgedriver
msedgedriver --version
fi
40 changes: 25 additions & 15 deletions catalyst_voices/test_driver/scripts/install-firefox-linux64.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
#!/bin/bash
# This script installs Firefox and Geckodriver. Geckodriver supported versions:
# https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
PLATFORM=linux64
# Firefox for linux/arm64 is only in the esr or the unstable version, using the latter

echo "Installing 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
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | tee /etc/apt/preferences.d/mozilla
apt-get update && apt-get install -y firefox
firefox --version

echo "Installing Geckodriver..."
if [ "$TARGETARCH" == "amd64" ]
then
PLATFORM=linux64
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
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | tee /etc/apt/preferences.d/mozilla
apt-get update && apt-get install -y firefox
firefox --version
else
PLATFORM=linux-aarch64
echo -e "\033[1;34mInstalling Firefox..."
echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 6ED0E7B82643E131
apt-get update && apt-get install -y libavcodec-extra firefox
firefox --version
fi
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"
tar -xzf /opt/geckodriver/geckodriver.tar.gz -C /opt/geckodriver/ && rm /opt/geckodriver/geckodriver.tar.gz
ln -s /opt/geckodriver/geckodriver /usr/local/bin/geckodriver
chmod +x /opt/geckodriver/geckodriver
geckodriver --version
geckodriver --version
Loading