From 86c2b7da7b9783cf27b41b4ababddde4fd6430a2 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Fri, 14 Jul 2023 21:46:32 -0400 Subject: [PATCH] [ci] Introduce LUCI versions of Linux desktop platform tests (#4223) Adds scripts and LUCI targets for the Linux desktop platform test tasks, corresponding to the Cirrus linux-platform_test tasks. Part of https://github.com/flutter/flutter/issues/114373 --- .ci.yaml | 29 +++++++++++++++++++++++ .ci/scripts/set_default_linux_apps.sh | 33 +++++++++++++++++++++++++++ .ci/scripts/xvfb_tool_runner.sh | 7 ++++++ .ci/targets/linux_platform_tests.yaml | 14 ++++++++++++ 4 files changed, 83 insertions(+) create mode 100755 .ci/scripts/set_default_linux_apps.sh create mode 100755 .ci/scripts/xvfb_tool_runner.sh create mode 100644 .ci/targets/linux_platform_tests.yaml diff --git a/.ci.yaml b/.ci.yaml index 9e42700e61..9fd29c7c1d 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -498,6 +498,35 @@ targets: target_file: linux_build_all_packages.yaml channel: stable + - name: Linux_desktop platform_tests master + bringup: true # New target + recipe: packages/packages + timeout: 30 + properties: + version_file: flutter_master.version + target_file: linux_platform_tests.yaml + channel: master + # Install Chrome as a default handler for schemes for url_launcher. + dependencies: >- + [ + {"dependency": "chrome_and_driver", "version": "version:114.0"} + ] + + - name: Linux_desktop platform_tests stable + bringup: true # New target + recipe: packages/packages + presubmit: false + timeout: 30 + properties: + version_file: flutter_stable.version + target_file: linux_platform_tests.yaml + channel: stable + # Install Chrome as a default handler for schemes for url_launcher. + dependencies: >- + [ + {"dependency": "chrome_and_driver", "version": "version:114.0"} + ] + ### iOS+macOS tasks ### # TODO(stuartmorgan): Move this to ARM once google_maps_flutter has ARM # support. `pod lint` makes a synthetic target that doesn't respect the diff --git a/.ci/scripts/set_default_linux_apps.sh b/.ci/scripts/set_default_linux_apps.sh new file mode 100755 index 0000000000..b30a678981 --- /dev/null +++ b/.ci/scripts/set_default_linux_apps.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +set -e + +# Set up a .desktop file pointing to the CIPD-installed Chrome. +readonly LOCAL_DESKTOP_FILE_DIR=~/.local/share/applications +mkdir -p "${LOCAL_DESKTOP_FILE_DIR}" +readonly DESKTOP_FILE_NAME=cipd-chrome.desktop +readonly CIPD_CHROME_DESKTOP_FILE="${LOCAL_DESKTOP_FILE_DIR}/${DESKTOP_FILE_NAME}" +cat << EOF > "${CIPD_CHROME_DESKTOP_FILE}" +[Desktop Entry] +Version=1.0 +Name=Google Chrome +GenericName=Web Browser +Comment=Access the Internet +Exec=${CHROME_EXECUTABLE} %U +StartupNotify=true +Terminal=false +Icon=google-chrome +Type=Application +Categories=Network;WebBrowser; +MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/file; +EOF + +# Enable xdg-* commands to work correctly. +export DESKTOP_SESSION=gnome + +# Set Chrome as the default handler for http, https, and file, for url_launcher +# tests that expect handlers for those schemes. +xdg-mime default "${DESKTOP_FILE_NAME}" inode/directory +xdg-settings set default-web-browser "${DESKTOP_FILE_NAME}" diff --git a/.ci/scripts/xvfb_tool_runner.sh b/.ci/scripts/xvfb_tool_runner.sh new file mode 100755 index 0000000000..285a1a93a7 --- /dev/null +++ b/.ci/scripts/xvfb_tool_runner.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +set -e + +xvfb-run ./script/tool_runner.sh "$@" diff --git a/.ci/targets/linux_platform_tests.yaml b/.ci/targets/linux_platform_tests.yaml new file mode 100644 index 0000000000..3455958ad0 --- /dev/null +++ b/.ci/targets/linux_platform_tests.yaml @@ -0,0 +1,14 @@ +tasks: + - name: prepare tool + script: .ci/scripts/prepare_tool.sh + - name: set default apps + script: .ci/scripts/set_default_linux_apps.sh + - name: build examples + script: script/tool_runner.sh + args: ["build-examples", "--linux"] + - name: native test + script: .ci/scripts/xvfb_tool_runner.sh + args: ["native-test", "--linux"] + - name: drive examples + script: .ci/scripts/xvfb_tool_runner.sh + args: ["drive-examples", "--linux", "--exclude=script/configs/exclude_integration_linux.yaml"]