Skip to content

[ci] Add LUCI version of build-all for Android #4236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ platform_properties:
linux:
properties:
os: Linux
linux_android:
properties:
os: Ubuntu
cores: "8"
device_type: none
dependencies: >-
[
{"dependency": "android_sdk", "version": "version:33v6"},
{"dependency": "open_jdk", "version": "version:11"},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were taken from flutter/flutter's configs. I believe it's similar to what we are currently using in Cirrus, so hopefully it'll transition smoothly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a different platform name to avoid confusion from framework ones, which needs a tethered android phone? Alternatively, I am wondering if we can consolidate the to-be-added (linux) platforms, and leave the dependencies difference on target level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a different platform name to avoid confusion from framework ones, which needs a tethered android phone?

IMO the flutter/flutter naming is confusing, because linux_android has one specific device, then there are a bunch of linux_android_somedevice variants with different devices. Why does linux_android not match the naming scheme there?

Also, I don't expect to need device-specific configs in this repo since we use FTL for device tests, so the naming should be much simpler here.

Alternatively, I am wondering if we can consolidate the to-be-added (linux) platforms, and leave the dependencies difference on target level.

Do you mean _desktop, _web, and _android? That would mean duplicating all of the generic platform-targeting configuration (These two lines for Android, cmake/clang/etc for desktop, etc.) for every single test, which makes things very redundant and harder to update. I would really like to avoid that.

Unless you mean putting all the things needed for all three into a single Linux configuration. I'm fine with that in terms of file structure, but I assume that slows things down unnecessarily in CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, I am wondering if we can consolidate the to-be-added (linux) platforms

(And FWIW, I believe this is the last one I will need to add. My plan was one generic one for things like Dart analyze and unit tests that have no target, and one for each of the three targets that Linux hosts are used for.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different platforms handling different set of tasks are expected, and sound good to me.

We have some metrics data depending on the platform assuming Linux_android targets are tied to a phone. Do you mind holding a bit on this PR before I find a good way to handle the metrics?

#4229 LGTM to merge.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created flutter/flutter#129039, I expect to fix it in the coming fixit week with a higher priority.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flutter/flutter#129039 is fixed. This should be unblocked.

{"dependency": "curl", "version": "version:7.64.0"}
]
linux_desktop:
properties:
os: Ubuntu
Expand Down Expand Up @@ -115,6 +126,27 @@ targets:
channel: stable
version_file: flutter_stable.version

### Android tasks ###
- name: Linux_android android_build_all_packages master
bringup: true # New target
recipe: packages/packages
timeout: 30
properties:
add_recipes_cq: "true"
version_file: flutter_master.version
target_file: android_build_all_packages.yaml
channel: master

- name: Linux_android android_build_all_packages stable
bringup: true # New target
recipe: packages/packages
timeout: 30
properties:
add_recipes_cq: "true"
version_file: flutter_stable.version
target_file: android_build_all_packages.yaml
channel: stable

### Web tasks ###
- name: Linux_web web_build_all_packages master
recipe: packages/packages
Expand Down
12 changes: 12 additions & 0 deletions .ci/scripts/build_all_packages_app_legacy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/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

platform="$1"
build_mode="$2"
output_dir="$3"
shift 3
cd "$output_dir"/all_packages
flutter build "$platform" --"$build_mode" "$@"
13 changes: 13 additions & 0 deletions .ci/scripts/create_all_packages_app_legacy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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

output_dir="$1"

# The output directory here must match the directory in
# build_all_packages_app_legacy.sh
dart ./script/tool/bin/flutter_plugin_tools.dart create-all-packages-app \
--legacy-source=.ci/legacy_project/all_packages --output-dir="$output_dir"/ \
--exclude script/configs/exclude_all_packages_app.yaml
23 changes: 23 additions & 0 deletions .ci/targets/android_build_all_packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 Android debug
script: .ci/scripts/build_all_packages_app.sh
args: ["apk", "debug"]
- name: build all_packages for Android release
script: .ci/scripts/build_all_packages_app.sh
args: ["apk", "release"]
- name: create all_packages app - legacy version
script: .ci/scripts/create_all_packages_app_legacy.sh
# Output dir; must match the final argument to build_all_packages_app_legacy
# below.
args: ["legacy"]
# Only build legacy in one mode, to minimize extra CI time. Debug is chosen
# somewhat arbitrarily as likely being slightly faster.
- name: build all_packages for Android - legacy version
script: .ci/scripts/build_all_packages_app_legacy.sh
# The final argument here must match the output directory passed to
# create_all_packages_app_legacy above.
args: ["apk", "debug", "legacy"]