From f156168ea0ab74bc5722152f93aacfc58a0679dd Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 15 Jun 2023 15:22:34 -0400 Subject: [PATCH 1/8] [ci] Introduce LUCI versions of Linux desktop tests Adds scripts and LUCI targets for the Linux desktop build-all and platform test tasks, corresponding to the Cirrus linux-build_all_packages and linux-platform_test tasks. Part of https://github.com/flutter/flutter/issues/114373 --- .ci.yaml | 52 ++++++++++++++++++++++- .ci/targets/linux_build_all_packages.yaml | 11 +++++ .ci/targets/linux_platform_tests.yaml | 12 ++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .ci/targets/linux_build_all_packages.yaml create mode 100644 .ci/targets/linux_platform_tests.yaml diff --git a/.ci.yaml b/.ci.yaml index e44c1479c26..a07085222f6 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -12,6 +12,18 @@ platform_properties: linux: properties: os: Linux + linux_desktop: + properties: + os: Ubuntu + cores: "8" + device_type: none + dependencies: >- + [ + {"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"}, + {"dependency": "cmake", "version": "build_id:8787856497187628321"}, + {"dependency": "ninja", "version": "version:1.9.0"}, + {"dependency": "curl", "version": "version:7.64.0"} + ] windows: properties: dependencies: > @@ -48,7 +60,7 @@ platform_properties: } targets: - ### Linux tasks ### + ### Linux-host tasks ### - name: Linux repo_tools_tests recipe: packages/packages timeout: 30 @@ -58,6 +70,44 @@ targets: channel: master version_file: flutter_master.version + ### Linux desktop tasks + - name: Linux_desktop build_all_packages master + bringup: true # New target + recipe: packages/packages + timeout: 30 + properties: + version_file: flutter_master.version + target_file: linux_build_all_packages.yaml + channel: master + + - name: Linux_desktop build_all_packages stable + bringup: true # New target + recipe: packages/packages + timeout: 30 + properties: + version_file: flutter_stable.version + 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 + + - 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 + ### 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/targets/linux_build_all_packages.yaml b/.ci/targets/linux_build_all_packages.yaml new file mode 100644 index 00000000000..b54f7b1e56c --- /dev/null +++ b/.ci/targets/linux_build_all_packages.yaml @@ -0,0 +1,11 @@ +tasks: + - name: prepare tool + script: .ci/scripts/prepare_tool.sh + - name: create all_packages app + script: .ci/scripts/create_all_packages_app.sh + - name: build all_packages for Linux debug + script: .ci/scripts/build_all_packages_app.sh + args: ["linux", "debug"] + - name: build all_packages for Linux release + script: .ci/scripts/build_all_packages_app.sh + args: ["linux", "release"] diff --git a/.ci/targets/linux_platform_tests.yaml b/.ci/targets/linux_platform_tests.yaml new file mode 100644 index 00000000000..e17c3814e33 --- /dev/null +++ b/.ci/targets/linux_platform_tests.yaml @@ -0,0 +1,12 @@ +tasks: + - name: prepare tool + script: .ci/scripts/prepare_tool.sh + - name: build examples + script: script/tool_runner.sh + args: ["build-examples", "--linux"] + - name: native test + script: script/tool_runner.sh + args: ["native-test", "--linux"] + - name: drive examples + script: script/tool_runner.sh + args: ["drive-examples", "--linux", "--exclude=script/configs/exclude_integration_linux.yaml"] From 732078cfed1d76e253ba1d8e58738ed185ae22ae Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 16 Jun 2023 10:13:10 -0400 Subject: [PATCH 2/8] Run Linux tests under xvfb, as in Cirrus --- .ci/scripts/xvfb_tool_runner.sh | 7 +++++++ .ci/targets/linux_platform_tests.yaml | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100755 .ci/scripts/xvfb_tool_runner.sh diff --git a/.ci/scripts/xvfb_tool_runner.sh b/.ci/scripts/xvfb_tool_runner.sh new file mode 100755 index 00000000000..285a1a93a77 --- /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 index e17c3814e33..40c780c2d0c 100644 --- a/.ci/targets/linux_platform_tests.yaml +++ b/.ci/targets/linux_platform_tests.yaml @@ -5,8 +5,8 @@ tasks: script: script/tool_runner.sh args: ["build-examples", "--linux"] - name: native test - script: script/tool_runner.sh + script: .ci/scripts/xvfb_tool_runner.sh args: ["native-test", "--linux"] - name: drive examples - script: script/tool_runner.sh + script: .ci/scripts/xvfb_tool_runner.sh args: ["drive-examples", "--linux", "--exclude=script/configs/exclude_integration_linux.yaml"] From ccf52b03886edf400244c21bdf07e8d9390a07c6 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 6 Jul 2023 10:20:56 -0400 Subject: [PATCH 3/8] Try a script that sets defaults, just to see --- .ci.yaml | 8 +++++++- .ci/scripts/set_default_linux_apps.sh | 8 ++++++++ .ci/targets/linux_platform_tests.yaml | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 .ci/scripts/set_default_linux_apps.sh diff --git a/.ci.yaml b/.ci.yaml index 02f927c1261..3ee382eb99a 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -292,8 +292,14 @@ targets: properties: add_recipes_cq: "true" version_file: flutter_master.version - target_file: linux_build_all_packages.yaml + # DO NOT LAND: For testing + target_file: linux_platform_tests.yaml channel: master + # DO NOT LAND: For testing + dependencies: >- + [ + {"dependency": "chrome_and_driver", "version": "version:114.0"} + ] - name: Linux_desktop build_all_packages stable recipe: packages/packages diff --git a/.ci/scripts/set_default_linux_apps.sh b/.ci/scripts/set_default_linux_apps.sh new file mode 100755 index 00000000000..fd8df475f07 --- /dev/null +++ b/.ci/scripts/set_default_linux_apps.sh @@ -0,0 +1,8 @@ +#!/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 + +xdg-mime default google-chrome.desktop inode/directory +xdg-settings set default-web-browser google-chrome.desktop diff --git a/.ci/targets/linux_platform_tests.yaml b/.ci/targets/linux_platform_tests.yaml index 40c780c2d0c..3455958ad05 100644 --- a/.ci/targets/linux_platform_tests.yaml +++ b/.ci/targets/linux_platform_tests.yaml @@ -1,6 +1,8 @@ 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"] From 53e544678fb4cdf265fd7813c4667bbe154ef128 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 12 Jul 2023 20:31:26 -0400 Subject: [PATCH 4/8] Fix xdg-* commands --- .ci/scripts/set_default_linux_apps.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.ci/scripts/set_default_linux_apps.sh b/.ci/scripts/set_default_linux_apps.sh index fd8df475f07..acf3b2ac41e 100755 --- a/.ci/scripts/set_default_linux_apps.sh +++ b/.ci/scripts/set_default_linux_apps.sh @@ -4,5 +4,29 @@ # found in the LICENSE file. set -e +# Set up a .desktop file pointing to the CIPD-installed Chrome. +LOCAL_DESKTOP_FILE_DIR=~/.local/share/applications +mkdir -p "$LOCAL_DESKTOP_FILE_DIR" +CIPD_CHROME_DESKTOP_FILE=${LOCAL_DESKTOP_FILE_DIR}/cipd-chrome.desktop +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 google-chrome.desktop inode/directory xdg-settings set default-web-browser google-chrome.desktop From 426f9c8425ce4dc0bb47d1123c474184029cd268 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 12 Jul 2023 21:38:17 -0400 Subject: [PATCH 5/8] Fix desktop file references --- .ci/scripts/set_default_linux_apps.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.ci/scripts/set_default_linux_apps.sh b/.ci/scripts/set_default_linux_apps.sh index acf3b2ac41e..e50c8b265a4 100755 --- a/.ci/scripts/set_default_linux_apps.sh +++ b/.ci/scripts/set_default_linux_apps.sh @@ -5,9 +5,10 @@ set -e # Set up a .desktop file pointing to the CIPD-installed Chrome. -LOCAL_DESKTOP_FILE_DIR=~/.local/share/applications +readonly LOCAL_DESKTOP_FILE_DIR=~/.local/share/applications mkdir -p "$LOCAL_DESKTOP_FILE_DIR" -CIPD_CHROME_DESKTOP_FILE=${LOCAL_DESKTOP_FILE_DIR}/cipd-chrome.desktop +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 @@ -28,5 +29,5 @@ 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 google-chrome.desktop inode/directory -xdg-settings set default-web-browser google-chrome.desktop +xdg-mime default $DESKTOP_FILE_NAME inode/directory +xdg-settings set default-web-browser $DESKTOP_FILE_NAME From 207ac5f2fefb6bd3f94d8fbad7b7d8dd4582a7b3 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 12 Jul 2023 22:03:05 -0400 Subject: [PATCH 6/8] Consistent bracing and quoting --- .ci/scripts/set_default_linux_apps.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/scripts/set_default_linux_apps.sh b/.ci/scripts/set_default_linux_apps.sh index e50c8b265a4..6ec344ed2e1 100755 --- a/.ci/scripts/set_default_linux_apps.sh +++ b/.ci/scripts/set_default_linux_apps.sh @@ -6,10 +6,10 @@ 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" +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" +cat << EOF > "${CIPD_CHROME_DESKTOP_FILE}" [Desktop Entry] Version=1.0 Name=Google Chrome @@ -29,5 +29,5 @@ 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 +xdg-mime default "${DESKTOP_FILE_NAME}" inode/directory +xdg-settings set default-web-browser "${DESKTOP_FILE_NAME}" From f204496f170ba6a7a70d75be426cddedc55d559a Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 12 Jul 2023 22:06:37 -0400 Subject: [PATCH 7/8] Undo hack for presubmit --- .ci.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index 0c9d67d8303..9fd29c7c1d9 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -487,14 +487,8 @@ targets: properties: add_recipes_cq: "true" version_file: flutter_master.version - # DO NOT LAND: For testing - target_file: linux_platform_tests.yaml + target_file: linux_build_all_packages.yaml channel: master - # DO NOT LAND: For testing - dependencies: >- - [ - {"dependency": "chrome_and_driver", "version": "version:114.0"} - ] - name: Linux_desktop build_all_packages stable recipe: packages/packages @@ -512,6 +506,11 @@ targets: 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 @@ -522,6 +521,11 @@ targets: 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 From 71134234d12be549a36fe6fe7e06c18487c4f6e8 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 13 Jul 2023 15:27:36 -0400 Subject: [PATCH 8/8] Missed bracing --- .ci/scripts/set_default_linux_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/scripts/set_default_linux_apps.sh b/.ci/scripts/set_default_linux_apps.sh index 6ec344ed2e1..b30a678981e 100755 --- a/.ci/scripts/set_default_linux_apps.sh +++ b/.ci/scripts/set_default_linux_apps.sh @@ -15,7 +15,7 @@ Version=1.0 Name=Google Chrome GenericName=Web Browser Comment=Access the Internet -Exec=$CHROME_EXECUTABLE %U +Exec=${CHROME_EXECUTABLE} %U StartupNotify=true Terminal=false Icon=google-chrome