Skip to content

Commit 066e47a

Browse files
[ci] Add LUCI version of Android FTL tests in bringup mode (#4571)
Adds new LUCI versions of the Android FTL tests. These are new tasks, rather than being part of android_platform_tests, since those are already running the emulator version of the tests, and the combination is far too slow (unless we roughly double the number of shards anyway), and this lets us control the behavior separately (e.g., not running them on `stable`, and potentially making them post-submit only in the future). Adjusts the repo tooling to make the `gcloud auth` step optional, since that's handled automatically for us in the LUCI environment, and to make it less tightly coupled to the Cirrus configuration by removing those defaults from the tool. Part of flutter/flutter#114373 See also flutter/flutter#131429
1 parent 10aab44 commit 066e47a

File tree

5 files changed

+143
-61
lines changed

5 files changed

+143
-61
lines changed

.ci.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,71 @@ targets:
464464
{"dependency": "android_virtual_device", "version": "33"}
465465
]
466466
467+
# Device versions of Android integration tests, run via FTL.
468+
# TODO(stuartmorgan): Revisit whether physical device tests are redundant once
469+
# we have more data about emulator tests; see
470+
# https://github.com/flutter/flutter/issues/131429.
471+
472+
- name: Linux_android android_device_tests_shard_1 master
473+
bringup: true # New target
474+
recipe: packages/packages
475+
timeout: 60
476+
properties:
477+
target_file: android_device_tests.yaml
478+
channel: master
479+
version_file: flutter_master.version
480+
package_sharding: "--shardIndex 0 --shardCount 6"
481+
482+
- name: Linux_android android_device_tests_shard_2 master
483+
bringup: true # New target
484+
recipe: packages/packages
485+
timeout: 60
486+
properties:
487+
target_file: android_device_tests.yaml
488+
channel: master
489+
version_file: flutter_master.version
490+
package_sharding: "--shardIndex 1 --shardCount 6"
491+
492+
- name: Linux_android android_device_tests_shard_3 master
493+
bringup: true # New target
494+
recipe: packages/packages
495+
timeout: 60
496+
properties:
497+
target_file: android_device_tests.yaml
498+
channel: master
499+
version_file: flutter_master.version
500+
package_sharding: "--shardIndex 2 --shardCount 6"
501+
502+
- name: Linux_android android_device_tests_shard_4 master
503+
bringup: true # New target
504+
recipe: packages/packages
505+
timeout: 60
506+
properties:
507+
target_file: android_device_tests.yaml
508+
channel: master
509+
version_file: flutter_master.version
510+
package_sharding: "--shardIndex 3 --shardCount 6"
511+
512+
- name: Linux_android android_device_tests_shard_5 master
513+
bringup: true # New target
514+
recipe: packages/packages
515+
timeout: 60
516+
properties:
517+
target_file: android_device_tests.yaml
518+
channel: master
519+
version_file: flutter_master.version
520+
package_sharding: "--shardIndex 4 --shardCount 6"
521+
522+
- name: Linux_android android_device_tests_shard_6 master
523+
bringup: true # New target
524+
recipe: packages/packages
525+
timeout: 60
526+
properties:
527+
target_file: android_device_tests.yaml
528+
channel: master
529+
version_file: flutter_master.version
530+
package_sharding: "--shardIndex 5 --shardCount 6"
531+
467532
### Web tasks ###
468533
- name: Linux_web web_build_all_packages master
469534
recipe: packages/packages
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
tasks:
2+
- name: prepare tool
3+
script: .ci/scripts/prepare_tool.sh
4+
infra_step: true # Note infra steps failing prevents "always" from running.
5+
- name: download Dart and Android deps
6+
script: script/tool_runner.sh
7+
infra_step: true
8+
args: ["fetch-deps", "--android", "--supporting-target-platforms-only"]
9+
- name: Firebase Test Lab
10+
script: script/tool_runner.sh
11+
args:
12+
- "firebase-test-lab"
13+
- "--device"
14+
- "model=redfin,version=30"
15+
- "--exclude=script/configs/exclude_integration_android.yaml"
16+
- "--project=flutter-infra-staging"
17+
- "--results-bucket=flutter_firebase_testlab_staging"

.cirrus.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ task:
8181
matrix:
8282
CHANNEL: "master"
8383
CHANNEL: "stable"
84+
GCLOUD_KEY_PATH: $HOME/gcloud-service-key.json
8485
MAPS_API_KEY: ENCRYPTED[d6583b08f79f91ea4844c77460f04539965e46ad2fd97fb7c062b4dfe88016228b86ebe8c220ab4187e0c4bd773dc1e7]
8586
GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[1a2eebf9367197bbe812d9a0ea83a53a05aeba4bb5e4964fe6a69727883cd87e51238d39237b1f80b0894c48419ac268]
8687
firebase_test_lab_script:
8788
- if [[ -n "$GCLOUD_FIREBASE_TESTLAB_KEY" ]]; then
88-
- echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json
89-
- ./script/tool_runner.sh firebase-test-lab --device model=redfin,version=30 --exclude=script/configs/exclude_integration_android.yaml
89+
- echo $GCLOUD_FIREBASE_TESTLAB_KEY > "${GCLOUD_KEY_PATH}"
90+
- ./script/tool_runner.sh firebase-test-lab --device model=redfin,version=30 --exclude=script/configs/exclude_integration_android.yaml --project=flutter-cirrus --results-bucket=flutter_cirrus_testlab --service-key="${GCLOUD_KEY_PATH}"
9091
- else
9192
- echo "This user does not have permission to run Firebase Test Lab tests."
9293
- fi

script/tool/lib/src/firebase_test_lab_command.dart

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'common/package_looping_command.dart';
1414
import 'common/plugin_utils.dart';
1515
import 'common/repository_package.dart';
1616

17-
const int _exitGcloudAuthFailed = 2;
17+
const int _exitGcloudAuthFailed = 3;
1818

1919
/// A command to run tests via Firebase test lab.
2020
class FirebaseTestLabCommand extends PackageLoopingCommand {
@@ -25,18 +25,13 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
2525
super.platform,
2626
}) {
2727
argParser.addOption(
28-
'project',
29-
defaultsTo: 'flutter-cirrus',
28+
_gCloudProjectArg,
3029
help: 'The Firebase project name.',
3130
);
32-
final String? homeDir = io.Platform.environment['HOME'];
33-
argParser.addOption('service-key',
34-
defaultsTo: homeDir == null
35-
? null
36-
: path.join(homeDir, 'gcloud-service-key.json'),
31+
argParser.addOption(_gCloudServiceKeyArg,
3732
help: 'The path to the service key for gcloud authentication.\n'
38-
r'If not provided, \$HOME/gcloud-service-key.json will be '
39-
r'assumed if $HOME is set.');
33+
'If not provided, setup will be skipped, so testing will fail '
34+
'unless gcloud is already configured.');
4035
argParser.addOption('test-run-id',
4136
defaultsTo: const Uuid().v4(),
4237
help:
@@ -57,15 +52,18 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
5752
],
5853
help:
5954
'Device model(s) to test. See https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run for more info');
60-
argParser.addOption('results-bucket',
61-
defaultsTo: 'gs://flutter_cirrus_testlab');
55+
argParser.addOption(_gCloudResultsBucketArg, mandatory: true);
6256
argParser.addOption(
6357
kEnableExperiment,
6458
defaultsTo: '',
6559
help: 'Enables the given Dart SDK experiments.',
6660
);
6761
}
6862

63+
static const String _gCloudServiceKeyArg = 'service-key';
64+
static const String _gCloudProjectArg = 'project';
65+
static const String _gCloudResultsBucketArg = 'results-bucket';
66+
6967
@override
7068
final String name = 'firebase-test-lab';
7169

@@ -82,9 +80,10 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
8280
return;
8381
}
8482

85-
final String serviceKey = getStringArg('service-key');
83+
final String serviceKey = getStringArg(_gCloudServiceKeyArg);
8684
if (serviceKey.isEmpty) {
87-
print('No --service-key provided; skipping gcloud authorization');
85+
print(
86+
'No --$_gCloudServiceKeyArg provided; skipping gcloud authorization');
8887
} else {
8988
final io.ProcessResult result = await processRunner.run(
9089
'gcloud',
@@ -99,11 +98,16 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
9998
printError('Unable to activate gcloud account.');
10099
throw ToolExit(_exitGcloudAuthFailed);
101100
}
101+
}
102+
final String project = getStringArg(_gCloudProjectArg);
103+
if (project.isEmpty) {
104+
print('No --$_gCloudProjectArg provided; skipping gcloud config');
105+
} else {
102106
final int exitCode = await processRunner.runAndStream('gcloud', <String>[
103107
'config',
104108
'set',
105109
'project',
106-
getStringArg('project'),
110+
project,
107111
]);
108112
print('');
109113
if (exitCode == 0) {
@@ -284,7 +288,7 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
284288
'build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk',
285289
'--timeout',
286290
'7m',
287-
'--results-bucket=${getStringArg('results-bucket')}',
291+
'--results-bucket=gs://${getStringArg(_gCloudResultsBucketArg)}',
288292
'--results-dir=$resultsDir',
289293
for (final String device in getStringListArg('device')) ...<String>[
290294
'--device',

0 commit comments

Comments
 (0)