From 782d26e3bb15d23aa7d9d3521c27ccf89f5649f1 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 15:11:42 -0500 Subject: [PATCH 01/19] Update CI config for Flutter 2 - Remove the temporarily-added beta branch testing. - Enable Linux and macOS on stable. - Combine the two different macOS matrix configurations now that they are the same. - Eliminate the NNBD plugin filtering for stable. --- .cirrus.yml | 78 +++++++++------------------------ script/build_all_plugins_app.sh | 11 ----- script/incremental_build.sh | 6 --- script/nnbd_plugins.sh | 49 --------------------- 4 files changed, 21 insertions(+), 123 deletions(-) delete mode 100644 script/nnbd_plugins.sh diff --git a/.cirrus.yml b/.cirrus.yml index 924cb63492a0..3f10b242b677 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,8 +11,6 @@ task: upgrade_script: - flutter channel stable - flutter upgrade - - flutter channel beta - - flutter upgrade - flutter channel master - flutter upgrade - git fetch origin master @@ -37,31 +35,22 @@ task: env: matrix: CHANNEL: "master" - CHANNEL: "beta" CHANNEL: "stable" test_script: - # TODO(jackson): Allow web plugins once supported on stable - # https://github.com/flutter/flutter/issues/42864 - - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - ./script/incremental_build.sh test - name: analyze env: matrix: CHANNEL: "master" - CHANNEL: "beta" CHANNEL: "stable" script: ./script/incremental_build.sh analyze - name: build_all_plugins_apk env: matrix: CHANNEL: "master" - CHANNEL: "beta" CHANNEL: "stable" script: - # TODO(jackson): Allow web plugins once supported on stable - # https://github.com/flutter/flutter/issues/42864 - - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh apk - name: integration_web_smoke_test @@ -86,14 +75,10 @@ task: PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4" matrix: CHANNEL: "master" - CHANNEL: "beta" CHANNEL: "stable" MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550] GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[07586610af1fdfc894e5969f70ef2458341b9b7e9c3b7c4225a663b4a48732b7208a4d91c3b7d45305a6b55fa2a37fc4] script: - # TODO(jackson): Allow web plugins once supported on stable - # https://github.com/flutter/flutter/issues/42864 - - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they # might include non-ASCII characters which makes Gradle crash. @@ -129,18 +114,23 @@ task: upgrade_script: - flutter channel stable - flutter upgrade - - flutter channel beta - - flutter upgrade - flutter channel master - flutter upgrade - git fetch origin master matrix: + - name: build_all_plugins_linux + script: + - flutter channel master + - ./script/build_all_plugins_app.sh linux - name: build-linux+drive-examples + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" install_script: - flutter config --enable-linux-desktop build_script: - # TODO(stuartmorgan): Include stable once Linux is supported on stable. - - flutter channel master + - flutter channel $CHANNEL - ./script/incremental_build.sh build-examples --linux - xvfb-run ./script/incremental_build.sh drive-examples --linux @@ -148,15 +138,13 @@ task: # Xcode 12 task # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins only_if: $CIRRUS_TAG == '' - use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' + use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' osx_instance: image: big-sur-xcode-12.3 upgrade_script: - sudo gem install cocoapods - flutter channel stable - flutter upgrade - - flutter channel beta - - flutter upgrade - flutter channel master - flutter upgrade - git fetch origin master @@ -168,12 +156,8 @@ task: env: matrix: CHANNEL: "master" - CHANNEL: "beta" CHANNEL: "stable" script: - # TODO(jackson): Allow web plugins once supported on stable - # https://github.com/flutter/flutter/issues/42864 - - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh ios --no-codesign - name: build-ipas+drive-examples @@ -187,21 +171,27 @@ task: PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4" matrix: CHANNEL: "master" - CHANNEL: "beta" CHANNEL: "stable" SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550] build_script: - # TODO(jackson): Allow web plugins once supported on stable - # https://github.com/flutter/flutter/issues/42864 - - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - - flutter upgrade - ./script/incremental_build.sh build-examples --ipa - ./script/incremental_build.sh xctest --skip $PLUGINS_TO_SKIP_XCTESTS --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest" # `drive-examples` contains integration tests, which changes the UI of the application. # This UI change sometimes affects `xctest`. # So we run `drive-examples` after `xctest`, changing the order will result ci failure. - ./script/incremental_build.sh drive-examples --ios + - name: build_all_plugins_macos + script: + - flutter channel master + - ./script/build_all_plugins_app.sh macos + - name: build-macos+drive-examples + env: + PATH: $PATH:/usr/local/bin + build_script: + - flutter channel master + - ./script/incremental_build.sh build-examples --macos --no-ipa + - ./script/incremental_build.sh drive-examples --macos - name: lint_darwin_plugins env: matrix: @@ -213,29 +203,3 @@ task: # Skip the dummy podspecs used to placate the tool. - find . -name "*_web*.podspec" -o -name "*_mac*.podspec" | xargs rm - ./script/incremental_build.sh podspecs - -task: - # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins - only_if: $CIRRUS_TAG == '' - use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' - osx_instance: - image: big-sur-xcode-12.3 - setup_script: - - flutter config --enable-macos-desktop - upgrade_script: - - sudo gem install cocoapods - - flutter channel master - - flutter upgrade - - git fetch origin master - matrix: - - name: build_all_plugins_app - script: - - flutter channel master - - ./script/build_all_plugins_app.sh macos - - name: build-apps+drive-examples - env: - PATH: $PATH:/usr/local/bin - build_script: - - flutter channel master - - ./script/incremental_build.sh build-examples --macos --no-ipa - - ./script/incremental_build.sh drive-examples --macos diff --git a/script/build_all_plugins_app.sh b/script/build_all_plugins_app.sh index 0cd6f4888e79..f066e60df6f4 100755 --- a/script/build_all_plugins_app.sh +++ b/script/build_all_plugins_app.sh @@ -14,7 +14,6 @@ readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)" readonly REPO_DIR="$(dirname "$SCRIPT_DIR")" source "$SCRIPT_DIR/common.sh" -source "$SCRIPT_DIR/nnbd_plugins.sh" check_changed_packages > /dev/null @@ -26,22 +25,12 @@ check_changed_packages > /dev/null # updating multiple plugins for a breaking change in a common dependency in # cases where using a relaxed version constraint isn't possible. readonly EXCLUDED_PLUGINS_LIST=( - # "file_selector" # currently out of sync with camera - # "flutter_plugin_android_lifecycle" - # "image_picker" - # "local_auth" # flutter_plugin_android_lifecycle conflict "plugin_platform_interface" # This should never be a direct app dependency. ) # Comma-separated string of the list above readonly EXCLUDED=$(IFS=, ; echo "${EXCLUDED_PLUGINS_LIST[*]}") ALL_EXCLUDED=($EXCLUDED) -# Exclude nnbd plugins from stable, and conflicting plugins otherwise. -if [ "$CHANNEL" == "stable" ]; then - ALL_EXCLUDED=("$EXCLUDED,$EXCLUDED_PLUGINS_FROM_STABLE") -else - ALL_EXCLUDED=("$EXCLUDED,$EXCLUDED_PLUGINS_FOR_NNBD") -fi echo "Excluding the following plugins: $ALL_EXCLUDED" diff --git a/script/incremental_build.sh b/script/incremental_build.sh index bc41ebd3c70d..826229bced60 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -5,15 +5,9 @@ readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" readonly REPO_DIR="$(dirname "$SCRIPT_DIR")" source "$SCRIPT_DIR/common.sh" -source "$SCRIPT_DIR/nnbd_plugins.sh" # Plugins that are excluded from this task. ALL_EXCLUDED=("") -# Exclude nnbd plugins from stable. -if [ "$CHANNEL" == "stable" ]; then - ALL_EXCLUDED=($EXCLUDED_PLUGINS_FROM_STABLE) - echo "Excluding the following plugins because stable does not yet support NNBD: $ALL_EXCLUDED" -fi # Plugins that deliberately use their own analysis_options.yaml. # diff --git a/script/nnbd_plugins.sh b/script/nnbd_plugins.sh deleted file mode 100644 index fb5f8eac44e9..000000000000 --- a/script/nnbd_plugins.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# This script contains the list of plugins migrated to nnbd -# that should be excluded from testing on Flutter stable until -# null-safe is available on stable. - -readonly NNBD_PLUGINS_LIST=( - "android_alarm_manager" - "android_intent" - "battery" - "camera" - "camera_platform_interface" - "connectivity" - "cross_file" - "device_info" - "espresso" - "file_selector" - "flutter_plugin_android_lifecycle" - "flutter_webview" - "google_maps_flutter" - "google_sign_in" - "image_picker" - "ios_platform_images" - "local_auth" - "path_provider" - "package_info" - "plugin_platform_interface" - "quick_actions" - "sensors" - "share" - "shared_preferences" - "url_launcher" - "video_player" - "webview_flutter" - "wifi_info_flutter" - "in_app_purchase" -) - -# This list contains the list of plugins that have *not* been -# migrated to nnbd, and conflict with those that have when -# building the all plugins app. This list should be kept empty. - -readonly NON_NNBD_PLUGINS_LIST=( - "extension_google_sign_in_as_googleapis_auth" - "google_maps_flutter_web" # Not yet migrated. -) - -export EXCLUDED_PLUGINS_FROM_STABLE=$(IFS=, ; echo "${NNBD_PLUGINS_LIST[*]}") -export EXCLUDED_PLUGINS_FOR_NNBD=$(IFS=, ; echo "${NON_NNBD_PLUGINS_LIST[*]}") From cca7c171386c654e33cc0179932839f6b4c35bcd Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 15:46:54 -0500 Subject: [PATCH 02/19] Combine Linux Dockerfiles and matrixes --- .ci/Dockerfile | 13 ++++- .ci/Dockerfile-LinuxDesktop | 31 ----------- .cirrus.yml | 100 +++++++++++++++++++----------------- 3 files changed, 66 insertions(+), 78 deletions(-) delete mode 100644 .ci/Dockerfile-LinuxDesktop diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 13ac087498d1..b4f7c2436d63 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -6,7 +6,7 @@ RUN sudo apt-get install -y --no-install-recommends gnupg # Add repo for gcloud sdk and install it RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ - sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - @@ -23,7 +23,18 @@ RUN yes | sdkmanager \ RUN yes | sdkmanager --licenses +# Install xvfb to allow running headless +RUN sudo apt-get install -y xvfb libegl1-mesa +# Install Linux desktop build tool requirements. +RUN sudo apt-get install -y clang cmake ninja-build file pkg-config +# Install necessary libraries. +RUN sudo apt-get install -y libgtk-3-dev + # Add repo for Google Chrome and install it RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable + +# Make Chrome the default so http: has a handler for url_launcher tests. +RUN sudo apt-get install -y xdg-utils +RUN xdg-settings set default-web-browser google-chrome.desktop diff --git a/.ci/Dockerfile-LinuxDesktop b/.ci/Dockerfile-LinuxDesktop deleted file mode 100644 index 63e4516e26fc..000000000000 --- a/.ci/Dockerfile-LinuxDesktop +++ /dev/null @@ -1,31 +0,0 @@ -FROM cirrusci/flutter:stable - -RUN sudo apt-get update -y - -RUN sudo apt-get install -y --no-install-recommends gnupg - -# Add repo for gcloud sdk and install it -RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ - sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list - -RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ - sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - - -RUN sudo apt-get update && sudo apt-get install -y google-cloud-sdk && \ - gcloud config set core/disable_usage_reporting true && \ - gcloud config set component_manager/disable_update_check true - -# Install xvfb to allow running headless -RUN sudo apt-get install -y xvfb libegl1-mesa -# Install Linux desktop build tool requirements. -RUN sudo apt-get install -y clang cmake ninja-build file pkg-config -# Install necessary libraries. -RUN sudo apt-get install -y libgtk-3-dev - -# Add repo for Google Chrome and install it, for url_launcher tests. -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - -RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list -RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable -# Make it the default so http: has a handler. -RUN sudo apt-get install -y xdg-utils -RUN xdg-settings set default-web-browser google-chrome.desktop diff --git a/.cirrus.yml b/.cirrus.yml index 3f10b242b677..405813355c5a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -15,6 +15,7 @@ task: - flutter upgrade - git fetch origin master matrix: + ### Platform-agnostic tasks ### - name: plugin_tools_tests script: - cd script/tool @@ -44,7 +45,10 @@ task: matrix: CHANNEL: "master" CHANNEL: "stable" - script: ./script/incremental_build.sh analyze + script: + - flutter channel $CHANNEL + - /script/incremental_build.sh analyze + ### Android tasks ### - name: build_all_plugins_apk env: matrix: @@ -53,19 +57,6 @@ task: script: - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh apk - - name: integration_web_smoke_test - # Tests integration example test in web. - only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" - install_script: - - flutter config --enable-web - - git clone https://github.com/flutter/web_installers.git - - cd web_installers/packages/web_drivers/ - - pub get - - dart lib/web_driver_installer.dart chromedriver --install-only - - ./chromedriver/chromedriver --port=4444 & - test_script: - - cd $INTEGRATION_TEST_PATH/example/ - - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome - name: build-apks+java-test+firebase-test-lab env: matrix: @@ -100,27 +91,33 @@ task: - fi - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` - -task: - # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins - only_if: $CIRRUS_TAG == '' - use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' - container: - dockerfile: .ci/Dockerfile-LinuxDesktop - cpu: 8 - memory: 16G - env: - INTEGRATION_TEST_PATH: "./packages/integration_test" - upgrade_script: - - flutter channel stable - - flutter upgrade - - flutter channel master - - flutter upgrade - - git fetch origin master - matrix: + ### Web tasks ### + - name: integration_web_smoke_test + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" + # Tests integration example test in web. + only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" + install_script: + - flutter channel $CHANNEL + - flutter config --enable-web + - git clone https://github.com/flutter/web_installers.git + - cd web_installers/packages/web_drivers/ + - pub get + - dart lib/web_driver_installer.dart chromedriver --install-only + - ./chromedriver/chromedriver --port=4444 & + test_script: + - cd $INTEGRATION_TEST_PATH/example/ + - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome + ### Linux desktop tasks ### - name: build_all_plugins_linux + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" script: - - flutter channel master + - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh linux - name: build-linux+drive-examples env: @@ -128,6 +125,7 @@ task: CHANNEL: "master" CHANNEL: "stable" install_script: + - flutter channel $CHANNEL - flutter config --enable-linux-desktop build_script: - flutter channel $CHANNEL @@ -152,6 +150,19 @@ task: - xcrun simctl list - xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-14-3 | xargs xcrun simctl boot matrix: + ### Platform-agnostic tasks ### + - name: lint_darwin_plugins + env: + matrix: + PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2" + PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2" + script: + # TODO(jmagman): Lint macOS podspecs but skip any that fail library validation. + - find . -name "*.podspec" | xargs grep -l "osx" | xargs rm + # Skip the dummy podspecs used to placate the tool. + - find . -name "*_web*.podspec" -o -name "*_mac*.podspec" | xargs rm + - ./script/incremental_build.sh podspecs + ### iOS tasks ### - name: build_all_plugins_ipa env: matrix: @@ -181,25 +192,22 @@ task: # This UI change sometimes affects `xctest`. # So we run `drive-examples` after `xctest`, changing the order will result ci failure. - ./script/incremental_build.sh drive-examples --ios + ### macOS desktop tasks ### - name: build_all_plugins_macos + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" script: - - flutter channel master + - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh macos - name: build-macos+drive-examples env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" PATH: $PATH:/usr/local/bin build_script: - - flutter channel master + - flutter channel $CHANNEL - ./script/incremental_build.sh build-examples --macos --no-ipa - ./script/incremental_build.sh drive-examples --macos - - name: lint_darwin_plugins - env: - matrix: - PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2" - PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2" - script: - # TODO(jmagman): Lint macOS podspecs but skip any that fail library validation. - - find . -name "*.podspec" | xargs grep -l "osx" | xargs rm - # Skip the dummy podspecs used to placate the tool. - - find . -name "*_web*.podspec" -o -name "*_mac*.podspec" | xargs rm - - ./script/incremental_build.sh podspecs From fba837fd71404a571be135d1e300c06a87e3ea18 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 16:01:02 -0500 Subject: [PATCH 03/19] Add build tests for web --- .cirrus.yml | 23 +++++++-- .../tool/lib/src/build_examples_command.dart | 51 +++++++++++-------- 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 405813355c5a..3712b1b9961d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,6 +13,7 @@ task: - flutter upgrade - flutter channel master - flutter upgrade + - flutter config --enable-linux-desktop - git fetch origin master matrix: ### Platform-agnostic tasks ### @@ -92,6 +93,23 @@ task: - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` ### Web tasks ### + - name: build_all_plugins_web + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" + script: + - flutter channel $CHANNEL + - ./script/build_all_plugins_app.sh web + - name: build-web-examples + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" + build_script: + - flutter channel $CHANNEL + - ./script/incremental_build.sh build-examples --web + # TODO: Add driving examples. - name: integration_web_smoke_test env: matrix: @@ -101,7 +119,6 @@ task: only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" install_script: - flutter channel $CHANNEL - - flutter config --enable-web - git clone https://github.com/flutter/web_installers.git - cd web_installers/packages/web_drivers/ - pub get @@ -124,9 +141,6 @@ task: matrix: CHANNEL: "master" CHANNEL: "stable" - install_script: - - flutter channel $CHANNEL - - flutter config --enable-linux-desktop build_script: - flutter channel $CHANNEL - ./script/incremental_build.sh build-examples --linux @@ -145,6 +159,7 @@ task: - flutter upgrade - flutter channel master - flutter upgrade + - flutter config --enable-macos-desktop - git fetch origin master create_simulator_script: - xcrun simctl list diff --git a/script/tool/lib/src/build_examples_command.dart b/script/tool/lib/src/build_examples_command.dart index 53da9086abaa..bb140bd429c6 100644 --- a/script/tool/lib/src/build_examples_command.dart +++ b/script/tool/lib/src/build_examples_command.dart @@ -19,6 +19,7 @@ class BuildExamplesCommand extends PluginCommand { }) : super(packagesDir, fileSystem, processRunner: processRunner) { argParser.addFlag(kLinux, defaultsTo: false); argParser.addFlag(kMacos, defaultsTo: false); + argParser.addFlag(kWeb, defaultsTo: false); argParser.addFlag(kWindows, defaultsTo: false); argParser.addFlag(kIpa, defaultsTo: io.Platform.isMacOS); argParser.addFlag(kApk); @@ -43,10 +44,10 @@ class BuildExamplesCommand extends PluginCommand { !argResults[kApk] && !argResults[kLinux] && !argResults[kMacos] && + !argResults[kWeb] && !argResults[kWindows]) { - print( - 'None of --linux, --macos, --windows, --apk nor --ipa were specified, ' - 'so not building anything.'); + print('None of --linux, --macos, --web, --windows, --apk, or --ipa were ' + 'specified, so not building anything.'); return; } final String flutterCommand = @@ -84,33 +85,43 @@ class BuildExamplesCommand extends PluginCommand { if (argResults[kMacos]) { print('\nBUILDING macOS for $packageName'); if (isMacOsPlugin(plugin, fileSystem)) { - // TODO(https://github.com/flutter/flutter/issues/46236): - // Builing macos without running flutter pub get first results - // in an error. int exitCode = await processRunner.runAndStream( - flutterCommand, ['pub', 'get'], + flutterCommand, + [ + 'build', + kMacos, + if (enableExperiment.isNotEmpty) + '--enable-experiment=$enableExperiment', + ], workingDir: example); if (exitCode != 0) { failingPackages.add('$packageName (macos)'); - } else { - exitCode = await processRunner.runAndStream( - flutterCommand, - [ - 'build', - kMacos, - if (enableExperiment.isNotEmpty) - '--enable-experiment=$enableExperiment', - ], - workingDir: example); - if (exitCode != 0) { - failingPackages.add('$packageName (macos)'); - } } } else { print('macOS is not supported by this plugin'); } } + if (argResults[kWeb]) { + print('\nBUILDING web for $packageName'); + if (isWebPlugin(plugin, fileSystem)) { + int buildExitCode = await processRunner.runAndStream( + flutterCommand, + [ + 'build', + kWeb, + if (enableExperiment.isNotEmpty) + '--enable-experiment=$enableExperiment', + ], + workingDir: example); + if (buildExitCode != 0) { + failingPackages.add('$packageName (web)'); + } + } else { + print('Web is not supported by this plugin'); + } + } + if (argResults[kWindows]) { print('\nBUILDING Windows for $packageName'); if (isWindowsPlugin(plugin, fileSystem)) { From 840f3afd1dda4230d4d79f81b649ba34b7a63688 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 16:39:49 -0500 Subject: [PATCH 04/19] Typo fix --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3712b1b9961d..0a61dbd5ffef 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -48,7 +48,7 @@ task: CHANNEL: "stable" script: - flutter channel $CHANNEL - - /script/incremental_build.sh analyze + - ./script/incremental_build.sh analyze ### Android tasks ### - name: build_all_plugins_apk env: From 04ffaa9c319ea891953c639db0f16ec72401d780 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 16:46:09 -0500 Subject: [PATCH 05/19] Test web; fix tests --- .../test/build_examples_command_test.dart | 74 ++++++++++++++++++- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/script/tool/test/build_examples_command_test.dart b/script/tool/test/build_examples_command_test.dart index eaf5049dcc02..65417525d710 100644 --- a/script/tool/test/build_examples_command_test.dart +++ b/script/tool/test/build_examples_command_test.dart @@ -201,7 +201,7 @@ void main() { output, orderedEquals([ '\nBUILDING macOS for $packageName', - '\macOS is not supported by this plugin', + 'macOS is not supported by this plugin', '\n\n', 'All builds successful!', ]), @@ -213,6 +213,7 @@ void main() { expect(processRunner.recordedCalls, orderedEquals([])); cleanupPackages(); }); + test('building for macos', () async { createFakePlugin('plugin', withExtraFiles: >[ @@ -244,14 +245,81 @@ void main() { expect( processRunner.recordedCalls, orderedEquals([ - ProcessCall(flutterCommand, ['pub', 'get'], - pluginExampleDirectory.path), ProcessCall(flutterCommand, ['build', 'macos'], pluginExampleDirectory.path), ])); cleanupPackages(); }); + test('building for web with no implementation results in no-op', () async { + createFakePlugin('plugin', withExtraFiles: >[ + ['example', 'test'], + ]); + + final Directory pluginExampleDirectory = + mockPackagesDir.childDirectory('plugin').childDirectory('example'); + + createFakePubspec(pluginExampleDirectory, isFlutter: true); + + final List output = await runCapturingPrint( + runner, ['build-examples', '--no-ipa', '--web']); + final String packageName = + p.relative(pluginExampleDirectory.path, from: mockPackagesDir.path); + + expect( + output, + orderedEquals([ + '\nBUILDING web for $packageName', + 'Web is not supported by this plugin', + '\n\n', + 'All builds successful!', + ]), + ); + + print(processRunner.recordedCalls); + // Output should be empty since running build-examples --macos with no macos + // implementation is a no-op. + expect(processRunner.recordedCalls, orderedEquals([])); + cleanupPackages(); + }); + + test('building for web', () async { + createFakePlugin('plugin', + withExtraFiles: >[ + ['example', 'test'], + ['example', 'web', 'index.html'], + ], + isWebPlugin: true); + + final Directory pluginExampleDirectory = + mockPackagesDir.childDirectory('plugin').childDirectory('example'); + + createFakePubspec(pluginExampleDirectory, isFlutter: true); + + final List output = await runCapturingPrint( + runner, ['build-examples', '--no-ipa', '--web']); + final String packageName = + p.relative(pluginExampleDirectory.path, from: mockPackagesDir.path); + + expect( + output, + orderedEquals([ + '\nBUILDING web for $packageName', + '\n\n', + 'All builds successful!', + ]), + ); + + print(processRunner.recordedCalls); + expect( + processRunner.recordedCalls, + orderedEquals([ + ProcessCall(flutterCommand, ['build', 'web'], + pluginExampleDirectory.path), + ])); + cleanupPackages(); + }); + test( 'building for Windows when plugin is not set up for Windows results in no-op', () async { From 624f134c9e0bc737c56e27a3fc45299f1e8ab5da Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 17:36:47 -0500 Subject: [PATCH 06/19] Revert Linux combination --- .ci/Dockerfile | 13 +------------ .ci/Dockerfile-LinuxDesktop | 31 +++++++++++++++++++++++++++++++ .cirrus.yml | 20 +++++++++++++++++++- 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 .ci/Dockerfile-LinuxDesktop diff --git a/.ci/Dockerfile b/.ci/Dockerfile index b4f7c2436d63..13ac087498d1 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -6,7 +6,7 @@ RUN sudo apt-get install -y --no-install-recommends gnupg # Add repo for gcloud sdk and install it RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ - sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - @@ -23,18 +23,7 @@ RUN yes | sdkmanager \ RUN yes | sdkmanager --licenses -# Install xvfb to allow running headless -RUN sudo apt-get install -y xvfb libegl1-mesa -# Install Linux desktop build tool requirements. -RUN sudo apt-get install -y clang cmake ninja-build file pkg-config -# Install necessary libraries. -RUN sudo apt-get install -y libgtk-3-dev - # Add repo for Google Chrome and install it RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable - -# Make Chrome the default so http: has a handler for url_launcher tests. -RUN sudo apt-get install -y xdg-utils -RUN xdg-settings set default-web-browser google-chrome.desktop diff --git a/.ci/Dockerfile-LinuxDesktop b/.ci/Dockerfile-LinuxDesktop new file mode 100644 index 000000000000..63e4516e26fc --- /dev/null +++ b/.ci/Dockerfile-LinuxDesktop @@ -0,0 +1,31 @@ +FROM cirrusci/flutter:stable + +RUN sudo apt-get update -y + +RUN sudo apt-get install -y --no-install-recommends gnupg + +# Add repo for gcloud sdk and install it +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ + sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + +RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ + sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - + +RUN sudo apt-get update && sudo apt-get install -y google-cloud-sdk && \ + gcloud config set core/disable_usage_reporting true && \ + gcloud config set component_manager/disable_update_check true + +# Install xvfb to allow running headless +RUN sudo apt-get install -y xvfb libegl1-mesa +# Install Linux desktop build tool requirements. +RUN sudo apt-get install -y clang cmake ninja-build file pkg-config +# Install necessary libraries. +RUN sudo apt-get install -y libgtk-3-dev + +# Add repo for Google Chrome and install it, for url_launcher tests. +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list +RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable +# Make it the default so http: has a handler. +RUN sudo apt-get install -y xdg-utils +RUN xdg-settings set default-web-browser google-chrome.desktop diff --git a/.cirrus.yml b/.cirrus.yml index 0a61dbd5ffef..dc99e97f3119 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,7 +13,6 @@ task: - flutter upgrade - flutter channel master - flutter upgrade - - flutter config --enable-linux-desktop - git fetch origin master matrix: ### Platform-agnostic tasks ### @@ -127,6 +126,25 @@ task: test_script: - cd $INTEGRATION_TEST_PATH/example/ - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome + +task: + # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins + only_if: $CIRRUS_TAG == '' + use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' + container: + dockerfile: .ci/Dockerfile-LinuxDesktop + cpu: 8 + memory: 16G + env: + INTEGRATION_TEST_PATH: "./packages/integration_test" + upgrade_script: + - flutter channel stable + - flutter upgrade + - flutter channel master + - flutter upgrade + - flutter config --enable-linux-desktop + - git fetch origin master + matrix: ### Linux desktop tasks ### - name: build_all_plugins_linux env: From 78006b0432e722b4e9c62da4cffb61123baa94b8 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 21:24:58 -0500 Subject: [PATCH 07/19] Exclude extension_google_sign_in_as_googleapis_auth from build_all --- script/build_all_plugins_app.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/build_all_plugins_app.sh b/script/build_all_plugins_app.sh index f066e60df6f4..93899e2af444 100755 --- a/script/build_all_plugins_app.sh +++ b/script/build_all_plugins_app.sh @@ -26,6 +26,8 @@ check_changed_packages > /dev/null # cases where using a relaxed version constraint isn't possible. readonly EXCLUDED_PLUGINS_LIST=( "plugin_platform_interface" # This should never be a direct app dependency. + "extension_google_sign_in_as_googleapis_auth" # Transitive dependency issues + # with integration_test. ) # Comma-separated string of the list above readonly EXCLUDED=$(IFS=, ; echo "${EXCLUDED_PLUGINS_LIST[*]}") From 6fcfb3e196c45c155fa3ddd5da863c052898e70a Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 21:45:25 -0500 Subject: [PATCH 08/19] Skip debug build-all for web --- script/build_all_plugins_app.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script/build_all_plugins_app.sh b/script/build_all_plugins_app.sh index 93899e2af444..f6b1c166069f 100755 --- a/script/build_all_plugins_app.sh +++ b/script/build_all_plugins_app.sh @@ -44,7 +44,14 @@ function error() { failures=0 -for version in "debug" "release"; do +BUILD_MODES=("debug" "release") +# Web doesn't support --debug for builds. +if [[ "$1" == "web" ]]; then + BUILD_MODES=("release") +fi + +for version in "${BUILD_MODES[@]}"; do + echo "Building $version..." (cd $REPO_DIR/all_plugins && flutter build $@ --$version) if [ $? -eq 0 ]; then From 5e066f2a79a3e5d9089c416074e66b63dcf3c364 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 23:01:38 -0500 Subject: [PATCH 09/19] Add newer explicit dependencies to Linux desktop Dockerfile --- .ci/Dockerfile-LinuxDesktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Dockerfile-LinuxDesktop b/.ci/Dockerfile-LinuxDesktop index 63e4516e26fc..94df31f07e0a 100644 --- a/.ci/Dockerfile-LinuxDesktop +++ b/.ci/Dockerfile-LinuxDesktop @@ -20,7 +20,7 @@ RUN sudo apt-get install -y xvfb libegl1-mesa # Install Linux desktop build tool requirements. RUN sudo apt-get install -y clang cmake ninja-build file pkg-config # Install necessary libraries. -RUN sudo apt-get install -y libgtk-3-dev +RUN sudo apt-get install -y libgtk-3-dev libblkid-dev liblzma-dev # Add repo for Google Chrome and install it, for url_launcher tests. RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - From 6ae872a9b2f1d935927596d19b522b124d0b5d27 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 23:07:09 -0500 Subject: [PATCH 10/19] Try Linux combination again with clang-format-8 This reverts commit 624f134c9e0bc737c56e27a3fc45299f1e8ab5da. --- .ci/Dockerfile | 13 ++++++++++- .ci/Dockerfile-LinuxDesktop | 31 ------------------------- .cirrus.yml | 26 ++++----------------- script/tool/lib/src/format_command.dart | 6 ++--- 4 files changed, 19 insertions(+), 57 deletions(-) delete mode 100644 .ci/Dockerfile-LinuxDesktop diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 13ac087498d1..199a4c7fde1b 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -6,7 +6,7 @@ RUN sudo apt-get install -y --no-install-recommends gnupg # Add repo for gcloud sdk and install it RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ - sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - @@ -23,7 +23,18 @@ RUN yes | sdkmanager \ RUN yes | sdkmanager --licenses +# Install xvfb to allow running headless +RUN sudo apt-get install -y xvfb libegl1-mesa +# Install Linux desktop build tool requirements. +RUN sudo apt-get install -y clang cmake ninja-build file pkg-config +# Install necessary libraries. +RUN sudo apt-get install -y libgtk-3-dev libblkid-dev liblzma-dev + # Add repo for Google Chrome and install it RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable + +# Make Chrome the default so http: has a handler for url_launcher tests. +RUN sudo apt-get install -y xdg-utils +RUN xdg-settings set default-web-browser google-chrome.desktop diff --git a/.ci/Dockerfile-LinuxDesktop b/.ci/Dockerfile-LinuxDesktop deleted file mode 100644 index 94df31f07e0a..000000000000 --- a/.ci/Dockerfile-LinuxDesktop +++ /dev/null @@ -1,31 +0,0 @@ -FROM cirrusci/flutter:stable - -RUN sudo apt-get update -y - -RUN sudo apt-get install -y --no-install-recommends gnupg - -# Add repo for gcloud sdk and install it -RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ - sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list - -RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ - sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - - -RUN sudo apt-get update && sudo apt-get install -y google-cloud-sdk && \ - gcloud config set core/disable_usage_reporting true && \ - gcloud config set component_manager/disable_update_check true - -# Install xvfb to allow running headless -RUN sudo apt-get install -y xvfb libegl1-mesa -# Install Linux desktop build tool requirements. -RUN sudo apt-get install -y clang cmake ninja-build file pkg-config -# Install necessary libraries. -RUN sudo apt-get install -y libgtk-3-dev libblkid-dev liblzma-dev - -# Add repo for Google Chrome and install it, for url_launcher tests. -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - -RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list -RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable -# Make it the default so http: has a handler. -RUN sudo apt-get install -y xdg-utils -RUN xdg-settings set default-web-browser google-chrome.desktop diff --git a/.cirrus.yml b/.cirrus.yml index dc99e97f3119..7db362566532 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,6 +13,7 @@ task: - flutter upgrade - flutter channel master - flutter upgrade + - flutter config --enable-linux-desktop - git fetch origin master matrix: ### Platform-agnostic tasks ### @@ -28,10 +29,10 @@ task: - name: format install_script: - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - - sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" + - sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" - sudo apt-get update - - sudo apt-get install -y --allow-unauthenticated clang-format-7 - format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-7 + - sudo apt-get install -y --allow-unauthenticated clang-format-8 + format_script: ./script/incremental_build.sh format --fail-on-change --clang-format=clang-format-8 - name: test env: matrix: @@ -126,25 +127,6 @@ task: test_script: - cd $INTEGRATION_TEST_PATH/example/ - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome - -task: - # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins - only_if: $CIRRUS_TAG == '' - use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' - container: - dockerfile: .ci/Dockerfile-LinuxDesktop - cpu: 8 - memory: 16G - env: - INTEGRATION_TEST_PATH: "./packages/integration_test" - upgrade_script: - - flutter channel stable - - flutter upgrade - - flutter channel master - - flutter upgrade - - flutter config --enable-linux-desktop - - git fetch origin master - matrix: ### Linux desktop tasks ### - name: build_all_plugins_linux env: diff --git a/script/tool/lib/src/format_command.dart b/script/tool/lib/src/format_command.dart index ec326b96c1f9..e1c14e04cfec 100644 --- a/script/tool/lib/src/format_command.dart +++ b/script/tool/lib/src/format_command.dart @@ -22,10 +22,10 @@ class FormatCommand extends PluginCommand { FileSystem fileSystem, { ProcessRunner processRunner = const ProcessRunner(), }) : super(packagesDir, fileSystem, processRunner: processRunner) { - argParser.addFlag('travis', hide: true); + argParser.addFlag('fail-on-change', hide: true); argParser.addOption('clang-format', defaultsTo: 'clang-format', - help: 'Path to executable of clang-format v5.'); + help: 'Path to executable of clang-format.'); } @override @@ -46,7 +46,7 @@ class FormatCommand extends PluginCommand { await _formatJava(googleFormatterPath); await _formatCppAndObjectiveC(); - if (argResults['travis']) { + if (argResults['fail-on-change']) { final bool modified = await _didModifyAnything(); if (modified) { throw ToolExit(1); From 24a5306e9c3cdb55e17cabb097e2ddfb75cbab37 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 23:42:04 -0500 Subject: [PATCH 11/19] Try lower-power machines for most Linux tasks --- .cirrus.yml | 97 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 37 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 7db362566532..f2d0b8381401 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,11 +1,12 @@ +# Light-workload tasks. +# These use default machines, with fewer CPUs, to reduce pressure on the +# concurrency limits. task: # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins only_if: $CIRRUS_TAG == '' use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' container: dockerfile: .ci/Dockerfile - cpu: 8 - memory: 16G env: INTEGRATION_TEST_PATH: "./packages/integration_test" upgrade_script: @@ -58,40 +59,6 @@ task: script: - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh apk - - name: build-apks+java-test+firebase-test-lab - env: - matrix: - PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4" - PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4" - PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4" - PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4" - matrix: - CHANNEL: "master" - CHANNEL: "stable" - MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550] - GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[07586610af1fdfc894e5969f70ef2458341b9b7e9c3b7c4225a663b4a48732b7208a4d91c3b7d45305a6b55fa2a37fc4] - script: - - flutter channel $CHANNEL - # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they - # might include non-ASCII characters which makes Gradle crash. - # See: https://github.com/flutter/flutter/issues/24935 - # This is a temporary workaround until we figure how to properly configure - # a UTF8 locale on Cirrus (or until the Gradle bug is fixed). - # TODO(amirh): Set the locale to UTF8. - - echo "$CIRRUS_CHANGE_MESSAGE" > /tmp/cirrus_change_message.txt - - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt - - export CIRRUS_CHANGE_MESSAGE="" - - export CIRRUS_COMMIT_MESSAGE="" - - ./script/incremental_build.sh build-examples --apk - - ./script/incremental_build.sh java-test # must come after apk build - - if [[ -n "$GCLOUD_FIREBASE_TESTLAB_KEY" ]]; then - - echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json - - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 - - else - - echo "This user does not have permission to run Firebase Test Lab tests." - - fi - - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` ### Web tasks ### - name: build_all_plugins_web env: @@ -109,7 +76,7 @@ task: build_script: - flutter channel $CHANNEL - ./script/incremental_build.sh build-examples --web - # TODO: Add driving examples. + # TODO: Add driving examples (and move to heavy-workload group). - name: integration_web_smoke_test env: matrix: @@ -136,6 +103,62 @@ task: script: - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh linux + +# Heavy-workload tasks. +# These use machines with more CPUs and memory, so will reduce parallelization +# for non-credit runs. +task: + # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins + only_if: $CIRRUS_TAG == '' + use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' + container: + dockerfile: .ci/Dockerfile + env: + INTEGRATION_TEST_PATH: "./packages/integration_test" + upgrade_script: + - flutter channel stable + - flutter upgrade + - flutter channel master + - flutter upgrade + - flutter config --enable-linux-desktop + - git fetch origin master + matrix: + ### Android tasks ### + - name: build-apks+java-test+firebase-test-lab + env: + matrix: + PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4" + PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4" + PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4" + PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4" + matrix: + CHANNEL: "master" + CHANNEL: "stable" + MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550] + GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[07586610af1fdfc894e5969f70ef2458341b9b7e9c3b7c4225a663b4a48732b7208a4d91c3b7d45305a6b55fa2a37fc4] + script: + - flutter channel $CHANNEL + # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they + # might include non-ASCII characters which makes Gradle crash. + # See: https://github.com/flutter/flutter/issues/24935 + # This is a temporary workaround until we figure how to properly configure + # a UTF8 locale on Cirrus (or until the Gradle bug is fixed). + # TODO(amirh): Set the locale to UTF8. + - echo "$CIRRUS_CHANGE_MESSAGE" > /tmp/cirrus_change_message.txt + - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt + - export CIRRUS_CHANGE_MESSAGE="" + - export CIRRUS_COMMIT_MESSAGE="" + - ./script/incremental_build.sh build-examples --apk + - ./script/incremental_build.sh java-test # must come after apk build + - if [[ -n "$GCLOUD_FIREBASE_TESTLAB_KEY" ]]; then + - echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json + - ./script/incremental_build.sh firebase-test-lab --device model=flame,version=29 --device model=starqlteue,version=26 + - else + - echo "This user does not have permission to run Firebase Test Lab tests." + - fi + - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` + - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` + ### Linux desktop tasks ### - name: build-linux+drive-examples env: matrix: From 1824749a94ee8ec134927ae4b8b6f6fde1681187 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 23:42:35 -0500 Subject: [PATCH 12/19] Add dependency to clang-format install --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index f2d0b8381401..c925596206cd 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -32,7 +32,7 @@ task: - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" - sudo apt-get update - - sudo apt-get install -y --allow-unauthenticated clang-format-8 + - sudo apt-get install -y --allow-unauthenticated clang-format-8 libllvm8 format_script: ./script/incremental_build.sh format --fail-on-change --clang-format=clang-format-8 - name: test env: From 94e29665b6f43ce85c94377777f6170d12d6900a Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 23:53:47 -0500 Subject: [PATCH 13/19] Try bionic... --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c925596206cd..7437f9812af6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -30,9 +30,9 @@ task: - name: format install_script: - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - - sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" + - sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" - sudo apt-get update - - sudo apt-get install -y --allow-unauthenticated clang-format-8 libllvm8 + - sudo apt-get install -y --allow-unauthenticated clang-format-8 format_script: ./script/incremental_build.sh format --fail-on-change --clang-format=clang-format-8 - name: test env: From 70ed0650b192fb9d2737c2fbddab763b63ae6a79 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Mar 2021 23:59:09 -0500 Subject: [PATCH 14/19] Move web integration to heavy group due to failures --- .cirrus.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 7437f9812af6..956c01da4f0e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -77,23 +77,6 @@ task: - flutter channel $CHANNEL - ./script/incremental_build.sh build-examples --web # TODO: Add driving examples (and move to heavy-workload group). - - name: integration_web_smoke_test - env: - matrix: - CHANNEL: "master" - CHANNEL: "stable" - # Tests integration example test in web. - only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" - install_script: - - flutter channel $CHANNEL - - git clone https://github.com/flutter/web_installers.git - - cd web_installers/packages/web_drivers/ - - pub get - - dart lib/web_driver_installer.dart chromedriver --install-only - - ./chromedriver/chromedriver --port=4444 & - test_script: - - cd $INTEGRATION_TEST_PATH/example/ - - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome ### Linux desktop tasks ### - name: build_all_plugins_linux env: @@ -158,6 +141,24 @@ task: - fi - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` + ### Web tasks ### + - name: integration_web_smoke_test + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" + # Tests integration example test in web. + only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" + install_script: + - flutter channel $CHANNEL + - git clone https://github.com/flutter/web_installers.git + - cd web_installers/packages/web_drivers/ + - pub get + - dart lib/web_driver_installer.dart chromedriver --install-only + - ./chromedriver/chromedriver --port=4444 & + test_script: + - cd $INTEGRATION_TEST_PATH/example/ + - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome ### Linux desktop tasks ### - name: build-linux+drive-examples env: From 09aa2b176d68c632265a1536967924667d4ffcbb Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 4 Mar 2021 00:01:21 -0500 Subject: [PATCH 15/19] Try a simple clang-format install in Dockerfile --- .ci/Dockerfile | 3 +++ .cirrus.yml | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 199a4c7fde1b..14000e2032ed 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -23,6 +23,9 @@ RUN yes | sdkmanager \ RUN yes | sdkmanager --licenses +# Install formatter. +RUN sudo apt-get install -y clang-format + # Install xvfb to allow running headless RUN sudo apt-get install -y xvfb libegl1-mesa # Install Linux desktop build tool requirements. diff --git a/.cirrus.yml b/.cirrus.yml index 956c01da4f0e..5e3da17047fc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -28,12 +28,7 @@ task: - flutter channel master - ./script/check_publish.sh - name: format - install_script: - - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - - sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main" - - sudo apt-get update - - sudo apt-get install -y --allow-unauthenticated clang-format-8 - format_script: ./script/incremental_build.sh format --fail-on-change --clang-format=clang-format-8 + format_script: ./script/incremental_build.sh format --fail-on-change - name: test env: matrix: From 8bc0afd1103441aa85659f35f771fb93fccbbe23 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 4 Mar 2021 00:14:59 -0500 Subject: [PATCH 16/19] Minor formatting change for clang-format version difference --- .../wifi_info_flutter/ios/Classes/WifiInfoFlutterPlugin.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/wifi_info_flutter/wifi_info_flutter/ios/Classes/WifiInfoFlutterPlugin.m b/packages/wifi_info_flutter/wifi_info_flutter/ios/Classes/WifiInfoFlutterPlugin.m index 3abdbeef5744..f0811dd92ef6 100644 --- a/packages/wifi_info_flutter/wifi_info_flutter/ios/Classes/WifiInfoFlutterPlugin.m +++ b/packages/wifi_info_flutter/wifi_info_flutter/ios/Classes/WifiInfoFlutterPlugin.m @@ -119,7 +119,9 @@ - (NSString*)convertCLAuthorizationStatusToString:(CLAuthorizationStatus)status case kCLAuthorizationStatusAuthorizedWhenInUse: { return @"authorizedWhenInUse"; } - default: { return @"unknown"; } + default: { + return @"unknown"; + } } } From 161afee9d320a09e5d88bfae1f4e4620a3f0b41a Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 4 Mar 2021 08:24:07 -0500 Subject: [PATCH 17/19] Use a legacy image just for web integration --- .ci/Dockerfile-LegacyChrome | 29 +++++++++++++++++++ .cirrus.yml | 58 +++++++++++++++++++++++++------------ 2 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 .ci/Dockerfile-LegacyChrome diff --git a/.ci/Dockerfile-LegacyChrome b/.ci/Dockerfile-LegacyChrome new file mode 100644 index 000000000000..13ac087498d1 --- /dev/null +++ b/.ci/Dockerfile-LegacyChrome @@ -0,0 +1,29 @@ +FROM cirrusci/flutter:stable + +RUN sudo apt-get update -y + +RUN sudo apt-get install -y --no-install-recommends gnupg + +# Add repo for gcloud sdk and install it +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ + sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + +RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ + sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - + +RUN sudo apt-get update && sudo apt-get install -y google-cloud-sdk && \ + gcloud config set core/disable_usage_reporting true && \ + gcloud config set component_manager/disable_update_check true + +RUN yes | sdkmanager \ + "platforms;android-27" \ + "build-tools;27.0.3" \ + "extras;google;m2repository" \ + "extras;android;m2repository" + +RUN yes | sdkmanager --licenses + +# Add repo for Google Chrome and install it +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list +RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends google-chrome-stable diff --git a/.cirrus.yml b/.cirrus.yml index 5e3da17047fc..ab84f6f26053 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -82,6 +82,46 @@ task: - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh linux +# Legacy Dockerfile configuration for web integration tests. +# https://github.com/flutter/web_installers doesn't yet support the current +# stable version of Chrome, so newly-generated Docker images don't work. +# TODO: Merge this task into the "Web tasks" section of the "Light-workload +# tasks" block above once web_installers has been updated to support Chrome 89 +# (which is what the current image generated from .ci/Dockerfile has). +task: + # don't run on release tags since it creates O(n^2) tasks where n is the number of plugins + only_if: $CIRRUS_TAG == '' + use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' + container: + dockerfile: .ci/Dockerfile-LegacyChrome + env: + INTEGRATION_TEST_PATH: "./packages/integration_test" + upgrade_script: + - flutter channel stable + - flutter upgrade + - flutter channel master + - flutter upgrade + - flutter config --enable-linux-desktop + - git fetch origin master + matrix: + - name: integration_web_smoke_test + env: + matrix: + CHANNEL: "master" + CHANNEL: "stable" + # Tests integration example test in web. + only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" + install_script: + - flutter channel $CHANNEL + - git clone https://github.com/flutter/web_installers.git + - cd web_installers/packages/web_drivers/ + - pub get + - dart lib/web_driver_installer.dart chromedriver --install-only + - ./chromedriver/chromedriver --port=4444 & + test_script: + - cd $INTEGRATION_TEST_PATH/example/ + - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome + # Heavy-workload tasks. # These use machines with more CPUs and memory, so will reduce parallelization # for non-credit runs. @@ -136,24 +176,6 @@ task: - fi - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` - ### Web tasks ### - - name: integration_web_smoke_test - env: - matrix: - CHANNEL: "master" - CHANNEL: "stable" - # Tests integration example test in web. - only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''" - install_script: - - flutter channel $CHANNEL - - git clone https://github.com/flutter/web_installers.git - - cd web_installers/packages/web_drivers/ - - pub get - - dart lib/web_driver_installer.dart chromedriver --install-only - - ./chromedriver/chromedriver --port=4444 & - test_script: - - cd $INTEGRATION_TEST_PATH/example/ - - flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome ### Linux desktop tasks ### - name: build-linux+drive-examples env: From 1ce1c59d1f855c1b3b7bd63199e67fc2f520dcd9 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 4 Mar 2021 12:20:53 -0800 Subject: [PATCH 18/19] Actually request the more powerful machines --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index ab84f6f26053..519e8caf4075 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -94,6 +94,8 @@ task: use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' container: dockerfile: .ci/Dockerfile-LegacyChrome + cpu: 8 + memory: 16G env: INTEGRATION_TEST_PATH: "./packages/integration_test" upgrade_script: From 4ebe28e02d3701b44a8040603786a41fa7525fa5 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 4 Mar 2021 12:21:26 -0800 Subject: [PATCH 19/19] ... in the right block --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 519e8caf4075..ea27c88b97e0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -94,8 +94,6 @@ task: use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' container: dockerfile: .ci/Dockerfile-LegacyChrome - cpu: 8 - memory: 16G env: INTEGRATION_TEST_PATH: "./packages/integration_test" upgrade_script: @@ -133,6 +131,8 @@ task: use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == '' container: dockerfile: .ci/Dockerfile + cpu: 8 + memory: 16G env: INTEGRATION_TEST_PATH: "./packages/integration_test" upgrade_script: