From 735879f3c1fb9533cfaedc0480e615dc3352f8ff Mon Sep 17 00:00:00 2001 From: bkioshn <35752733+bkioshn@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:36:40 +0700 Subject: [PATCH] fix: flutter ci (#262) * fix: disable flutter analytics * fix: browser installer * fix: apt-get update * fix: firefox version * fix: update chrome version * chore: code structure * fix: permanent disable flutter analytic * chore: revert line --- earthly/flutter/Earthfile | 18 +++++- earthly/flutter/installer/Earthfile | 94 ++++++++++++++--------------- 2 files changed, 60 insertions(+), 52 deletions(-) diff --git a/earthly/flutter/Earthfile b/earthly/flutter/Earthfile index 5d6e49023..9e3583ca4 100644 --- a/earthly/flutter/Earthfile +++ b/earthly/flutter/Earthfile @@ -26,11 +26,23 @@ flutter-base: WORKDIR frontend - DO installer+INSTALL_CHROME_LINUX64 - DO installer+INSTALL_EDGE_LINUX64 - DO installer+INSTALL_FIREFOX_LINUX64 + ARG chrome_version = 126.0.6478.61 + ARG chrome_package_release = 1 + ARG chromium_version =126.0.6478.56-1~deb12u1 + DO installer+INSTALL_CHROME_LINUX64 --chrome_version=$chrome_version --chrome_package_release=$chrome_package_release --chromium_version=$chromium_version + + ARG edge_version = 125.0.2535.51 + ARG edge_package_release = 1 + DO installer+INSTALL_EDGE_LINUX64 --edge_version=$edge_version --edge_package_release=$edge_package_release + + ARG firefox_version_amd64 = 126.0~build2 + ARG firefox_version_arm64 = 115.12.0esr-1~deb12u1 + ARG gecko_version = 0.34.0 + DO installer+INSTALL_FIREFOX_LINUX64 --firefox_version_amd64=$firefox_version_amd64 --firefox_version_arm64=$firefox_version_arm64 --gecko_version=$gecko_version + COPY +flutter-src/flutter /usr/local ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:$HOME/.pub-cache/bin:${PATH}" + RUN flutter config --no-analytics RUN flutter --version RUN flutter doctor -v RUN flutter config --enable-web diff --git a/earthly/flutter/installer/Earthfile b/earthly/flutter/installer/Earthfile index 88059ade5..7b5f7e2a7 100644 --- a/earthly/flutter/installer/Earthfile +++ b/earthly/flutter/installer/Earthfile @@ -5,53 +5,47 @@ VERSION 0.8 # Install 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 - -LET BLUE = "\033[1;34m" - INSTALL_CHROME_LINUX64: FUNCTION ARG TARGETARCH + LET BLUE ='\033[0;34m' # https://googlechromelabs.github.io/chrome-for-testing/ IF [ "$TARGETARCH" = "amd64" ] - LET DISTR = "Debian 12 (Bookworm)" - LET CHROME_VERSION = 125.0.6422.76 - - RUN echo "${BLUE}Installing Google Chrome..." - # Installing dependencies for Chrome. Workaround for: - # https://github.com/GoogleChromeLabs/chrome-for-testing/issues/55 - RUN chrome_deps=$(curl -s "https://raw.githubusercontent.com/chromium/chromium/${CHROME_VERSION}/chrome/installer/linux/debian/dist_package_versions.json") && \ - deps=$(echo "$chrome_deps" | jq -r ".\"$DISTR\" | keys[]") && \ - apt-get update && \ - echo "$deps" | xargs apt-get install -y - - # Install Chrome - RUN mkdir -p /opt/chrome - RUN curl -L "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chrome-linux64.zip" \ - -o /opt/chrome/chrome.zip - RUN unzip -d /opt/chrome -j /opt/chrome/chrome.zip - RUN ln -s /opt/chrome/chrome /usr/local/bin/google-chrome + ARG --required chrome_version + ARG --required chrome_package_release + # Install Google Chrome + RUN printf "${BLUE} Installing Google Chrome..." + RUN curl -sSL -o /opt/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${chrome_version}-${chrome_package_release}_amd64.deb \ + && apt install -y /opt/chrome.deb \ + && rm /opt/chrome.deb \ + && mv /usr/bin/google-chrome-stable /usr/bin/google-chrome RUN google-chrome --version # Install Chromedriver - RUN echo "${BLUE}Installing Chromedriver..." - RUN mkdir -p /opt/chromedriver - RUN curl -L "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chromedriver-linux64.zip" \ - -o /opt/chromedriver/chromedriver.zip - RUN unzip -d /opt/chromedriver -j /opt/chromedriver/chromedriver.zip - RUN ln -s /opt/chromedriver/chromedriver /usr/local/bin/chromedriver + RUN printf "${BLUE} Installing Chromedriver..." + RUN mkdir -p /opt/chromedriver \ + && curl -L https://storage.googleapis.com/chrome-for-testing-public/${chrome_version}/linux64/chromedriver-linux64.zip \ + -o /opt/chromedriver/chromedriver.zip \ + && unzip -j /opt/chromedriver/chromedriver.zip -d /usr/local/bin/ RUN chromedriver --version + ELSE + # Chromium source: https://packages.debian.org/source/bookworm/chromium + ARG --required chromium_version # Install Chromium - RUN echo "${BLUE}Installing Chromium..." - RUN apt-get update - RUN apt-get install -y chromium - RUN ln -s /usr/bin/chromium /usr/local/bin/google-chrome + RUN printf "${BLUE} Installing Chromium..." + RUN curl -sSL -o /opt/chromium.deb http://security.debian.org/debian-security/pool/updates/main/c/chromium/chromium_${chromium_version}_arm64.deb \ + && apt install -y /opt/chromium.deb \ + && rm /opt/chromium.deb \ + && mv /usr/bin/chromium /usr/bin/google-chrome RUN google-chrome --version # Install Chromium-driver - RUN echo "${BLUE}Installing Chromium-driver..." - RUN apt-get install chromium-driver + RUN printf "${BLUE} Installing Chromium-driver..." + RUN curl -sSL -o /opt/chrome-driver.deb http://security.debian.org/debian-security/pool/updates/main/c/chromium/chromium-driver_${chromium_version}_arm64.deb \ + && apt install -y /opt/chrome-driver.deb \ + && rm /opt/chrome-driver.deb RUN chromedriver --version END @@ -60,19 +54,21 @@ INSTALL_CHROME_LINUX64: INSTALL_EDGE_LINUX64: FUNCTION ARG TARGETARCH - LET EDGE_VERSION = 125.0.2535.51 + LET BLUE ='\033[0;34m' IF [ "$TARGETARCH" = "amd64" ] - # https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable - RUN echo "${BLUE}Installing Edge..." - RUN curl -LO "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_${EDGE_VERSION}-1_amd64.deb" - RUN apt-get install -y ./microsoft-edge-stable_"$EDGE_VERSION"-1_amd64.deb + ARG --required edge_version + ARG --required edge_package_release + + RUN printf "${BLUE} Installing Edge..." + RUN curl -LO https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_${edge_version}-${edge_package_release}_amd64.deb + RUN apt-get update && apt-get install -y ./microsoft-edge-stable_${edge_version}-${edge_package_release}_amd64.deb RUN microsoft-edge-stable --version # https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver - RUN echo "${BLUE}Installing Edgedriver..." + RUN printf "${BLUE} Installing Edgedriver..." RUN mkdir -p /opt/edgedriver - RUN curl -L https://msedgedriver.azureedge.net/"$EDGE_VERSION"/edgedriver_linux64.zip \ + RUN curl -L https://msedgedriver.azureedge.net/{$edge_version}/edgedriver_linux64.zip \ -o /opt/edgedriver/edgedriver.zip RUN unzip /opt/edgedriver/edgedriver.zip -d /usr/local/bin/ RUN msedgedriver --version @@ -81,14 +77,13 @@ INSTALL_EDGE_LINUX64: # Install Firefox and Geckodriver. # Geckodriver supported versions: # https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html -# Firefox for linux/arm64 is only in the esr or the unstable version, using the latter. INSTALL_FIREFOX_LINUX64: FUNCTION ARG TARGETARCH LET PLATFORM = "" - LET GECKO_VERSION = 0.34.0 + LET BLUE ='\033[0;34m' - RUN echo "${BLUE}Installing Firefox..." + RUN printf "${BLUE} Installing Firefox..." WAIT RUN install -d -m 0755 /etc/apt/keyrings RUN curl -fSsL https://packages.mozilla.org/apt/repo-signing-key.gpg \ @@ -97,22 +92,23 @@ INSTALL_FIREFOX_LINUX64: | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null RUN echo "Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000\n\n" \ | tee /etc/apt/preferences.d/mozilla > /dev/null - RUN apt-get update END IF [ "$TARGETARCH" = "amd64" ] SET PLATFORM = linux64 - RUN apt-get install -y -t mozilla firefox=126.0~build2 + ARG --required firefox_version_amd64 + RUN apt-get update && apt-get install -y -t mozilla firefox=${firefox_version_amd64} ELSE SET PLATFORM = linux-aarch64 - RUN apt-get install -y -t mozilla firefox-esr=115.12.0esr-1~deb12u1 + ARG --required firefox_version_arm64 + RUN apt-get update && apt-get install -y -t mozilla firefox-esr=${firefox_version_arm64} END - RUN firefox --version - - RUN echo "${BLUE}Installing Geckodriver..." + + RUN printf "${BLUE} Installing Geckodriver..." RUN mkdir -p /opt/geckodriver - RUN curl -sL "https://github.com/mozilla/geckodriver/releases/download/v${GECKO_VERSION}/geckodriver-v${GECKO_VERSION}-${PLATFORM}.tar.gz" \ + ARG --required gecko_version + RUN curl -sL https://github.com/mozilla/geckodriver/releases/download/v${gecko_version}/geckodriver-v${gecko_version}-${PLATFORM}.tar.gz \ | tar -xz -C /opt/geckodriver/ RUN ln -s /opt/geckodriver/geckodriver /usr/local/bin/geckodriver RUN geckodriver --version