diff --git a/.config/dictionaries/project.dic b/.config/dictionaries/project.dic index 4f507faa1..809b2f1da 100644 --- a/.config/dictionaries/project.dic +++ b/.config/dictionaries/project.dic @@ -1,9 +1,10 @@ aarch bindgen buildkit -cardano -canvaskit camelcase +canvaskit +cardano +Chromedriver codegen colordiff cowsay @@ -15,6 +16,8 @@ dockerhub doublecircle Earthfile Earthfiles +edgedriver +Edgedriver errchkjson extldflags fira @@ -24,6 +27,8 @@ fontawesome fontconfig fontname forcelabels +geckodriver +Geckodriver genpkey giga ginkgolinter @@ -58,6 +63,7 @@ mithril mkdocs modcache mozallowfullscreen +msedgedriver multirepo nextest nilnil @@ -68,8 +74,8 @@ penwidth pkeyopt pkgs projectcatalyst -pubspec pubout +pubspec pymdownx PYTHONDONTWRITEBYTECODE rankdir @@ -79,8 +85,8 @@ rustdoc rustdocflags rustflags rustfmt -sanchonet rustup +sanchonet sqlfluff stdcfgs subproject diff --git a/earthly/flutter/Earthfile b/earthly/flutter/Earthfile index 2187ee485..f1b5504a7 100644 --- a/earthly/flutter/Earthfile +++ b/earthly/flutter/Earthfile @@ -2,7 +2,7 @@ VERSION 0.8 IMPORT ./installer AS installer -# flutter-src - save Flutter source code as artifact. +# flutter-src save Flutter source code as artifact. flutter-src: FROM busybox ARG version=3.22.1 @@ -17,19 +17,22 @@ flutter-src: END SAVE ARTIFACT /flutter flutter -# flutter-base - installs required tools and packages. +# flutter-base installs required tools and packages. flutter-base: FROM debian:bookworm-20240513-slim - RUN apt-get update - RUN apt-get install -y git curl unzip bzip2 bash jq gpg lcov + RUN apt-get update --fix-missing + RUN apt-get install -y apt-utils git curl gzip unzip bzip2 bash jq gpg lcov WORKDIR frontend - ARG chrome_version = 126.0.6478.61 - ARG chrome_package_release = 1 - ARG chromium_version = 126.0.6478.126-1~deb12u1 - DO installer+INSTALL_CHROME_LINUX64 --chrome_version=$chrome_version --chrome_package_release=$chrome_package_release --chromium_version=$chromium_version + # TARGETARCH is the target processor architecture for which the target is being built. + # WARNING: The value of a builtin arg (earthly) and can never be overridden! + # Read more about it here: https://docs.earthly.dev/docs/earthfile/builtin-args#platform-related-args + ARG TARGETARCH + ARG CHROME_MAJOR_VERSION = 126.0.6478.61 + + DO installer+INSTALL_CHROME_LINUX64 --TARGET_ARCH=$TARGETARCH --CHROME_MAJOR_VERSION=$CHROME_MAJOR_VERSION ARG edge_version = 125.0.2535.51 ARG edge_package_release = 1 @@ -50,6 +53,7 @@ flutter-base: RUN dart pub global activate junitreport RUN dart pub global activate coverage +# flutter-base-all-hosts installs required tools and packages for all hosts. flutter-base-all-hosts: BUILD --platform=linux/amd64 --platform=linux/arm64 +flutter-base @@ -172,7 +176,7 @@ BUILD_WEB: SAVE ARTIFACT web /web END -# Base license checker setup. +# license-checker-base base license checker setup. license-checker-base: DO +SETUP COPY ./template_license_checker.yaml . diff --git a/earthly/flutter/installer/Earthfile b/earthly/flutter/installer/Earthfile index 7b5f7e2a7..2aec802e5 100644 --- a/earthly/flutter/installer/Earthfile +++ b/earthly/flutter/installer/Earthfile @@ -1,22 +1,49 @@ VERSION 0.8 -# cspell: words Chromedriver Edgedriver edgedriver msedgedriver Geckodriver geckodriver +# Installs the Chromium or Chrome driver. +INSTALL_CHROMIUM: + FUNCTION + + ARG --required PACKAGE_TYPE + ARG --required DOWNLOAD_URL + LET BLUE='\033[0;34m' + + RUN printf "${BLUE} Installing the latest ${PACKAGE_TYPE} version...\n" \ + && echo "Downloading ${PACKAGE_TYPE} and dependencies from: ${DOWNLOAD_URL}" \ + && curl -sSL -o /opt/${PACKAGE_TYPE}.zip ${DOWNLOAD_URL} \ + && echo "Downloaded file information:" \ + && ls -lh /opt/${PACKAGE_TYPE}.zip \ + && echo "Unzipping ${PACKAGE_TYPE} packages..." \ + && unzip /opt/${PACKAGE_TYPE}.zip -d /opt/${PACKAGE_TYPE} \ + && echo "Contents of /opt/${PACKAGE_TYPE} after unzipping:" \ + && ls -lh /opt/${PACKAGE_TYPE}/${PACKAGE_TYPE} \ + && echo "Installing ${PACKAGE_TYPE} and dependencies..." \ + && dpkg -i /opt/${PACKAGE_TYPE}/${PACKAGE_TYPE}/*.deb || true \ + && echo "Checking for missing dependencies..." \ + && apt-get install -f -y \ + && echo "Re-attempting to install ${PACKAGE_TYPE} and dependencies..." \ + && dpkg -i /opt/${PACKAGE_TYPE}/${PACKAGE_TYPE}/*.deb \ + && echo "Cleaning up..." \ + && rm /opt/${PACKAGE_TYPE}.zip \ + && rm -r /opt/${PACKAGE_TYPE} \ + && echo "${PACKAGE_TYPE} installation completed." # 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 +# Define a function to install Chrome or Chromium based on the target architecture. INSTALL_CHROME_LINUX64: FUNCTION - ARG TARGETARCH - LET BLUE ='\033[0;34m' - # https://googlechromelabs.github.io/chrome-for-testing/ - IF [ "$TARGETARCH" = "amd64" ] - ARG --required chrome_version - ARG --required chrome_package_release - # Install Google Chrome + ARG TARGET_ARCH = amd64 + LET BLUE='\033[0;34m' + + IF [ "$TARGET_ARCH" = "amd64" ] + ARG CHROME_MAJOR_VERSION + + # 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 \ + RUN curl -sSL -o /opt/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_MAJOR_VERSION}-1_amd64.deb \ && apt install -y /opt/chrome.deb \ && rm /opt/chrome.deb \ && mv /usr/bin/google-chrome-stable /usr/bin/google-chrome @@ -25,27 +52,18 @@ INSTALL_CHROME_LINUX64: # Install 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 \ + && curl -L https://storage.googleapis.com/chrome-for-testing-public/${CHROME_MAJOR_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 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 + ELSE + # Install Chromium. + DO +INSTALL_CHROMIUM --PACKAGE_TYPE="chromium" --DOWNLOAD_URL="https://iog-catalyst-cache.s3.eu-central-1.amazonaws.com/chromium.zip" + RUN chromium --version # 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 + DO +INSTALL_CHROMIUM --PACKAGE_TYPE="chromium-driver" --DOWNLOAD_URL="https://iog-catalyst-cache.s3.eu-central-1.amazonaws.com/chromium-driver.zip" RUN chromedriver --version END @@ -53,7 +71,7 @@ INSTALL_CHROME_LINUX64: # There is no Edge version build for linux/arm64, installing only for amd64. INSTALL_EDGE_LINUX64: FUNCTION - ARG TARGETARCH + LET BLUE ='\033[0;34m' IF [ "$TARGETARCH" = "amd64" ] @@ -74,7 +92,7 @@ INSTALL_EDGE_LINUX64: RUN msedgedriver --version END -# Install Firefox and Geckodriver. +# Install Firefox and Geckodriver. # Geckodriver supported versions: # https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html INSTALL_FIREFOX_LINUX64: @@ -104,7 +122,7 @@ INSTALL_FIREFOX_LINUX64: RUN apt-get update && apt-get install -y -t mozilla firefox-esr=${firefox_version_arm64} END RUN firefox --version - + RUN printf "${BLUE} Installing Geckodriver..." RUN mkdir -p /opt/geckodriver ARG --required gecko_version diff --git a/examples/flutter/example/Earthfile b/examples/flutter/example/Earthfile index 5a9c483df..e42dd63de 100644 --- a/examples/flutter/example/Earthfile +++ b/examples/flutter/example/Earthfile @@ -4,19 +4,19 @@ IMPORT ../../../earthly/flutter AS flutter-ci # To see more available functions, navigate to earthly/flutter/Earthfile. -# builder - Set up the CI environment for Flutter app. +# Set up the CI environment for Flutter app. builder: DO flutter-ci+SETUP COPY --dir . . -# analyze - Run Flutter analyze orer melos analyze. +# Run Flutter analyze orer melos analyze. analyze: FROM +builder DO flutter-ci+ANALYZE -# format - Run Flutter format orer melos format. +# Run Flutter format orer melos format. format: FROM +builder @@ -28,7 +28,7 @@ unit-tests: DO flutter-ci+UNIT_TEST -# build-web - Build the Flutter app for the web. +# Build the Flutter app for the web. # Assuming that we have a main.dart file in lib folder and we run `build-web` in folder # with pubspec.yaml file: earthly +build-web --TARGET=lib/main.dart build-web: @@ -39,9 +39,9 @@ build-web: DO flutter-ci+BUILD_WEB --WORKDIR=$WORKDIR --TARGET=$TARGET -# check-license - Check the licenses of the Flutter dependencies. +# Check the licenses of the Flutter dependencies. check-license: FROM flutter-ci+license-checker-base - + COPY . . DO flutter-ci+LICENSE_CHECK --license_checker_file=license_checker.yaml \ No newline at end of file