mirror of
https://github.com/flutter/packages.git
synced 2025-06-11 15:21:07 +08:00
[flutter_plugin_tools] Add a summary for successful runs (#4118)
Add a summary to the end of successful runs for everything using the new looping base command, similar to what we do for summarizing failures. This will make it easy to manually check results for PRs that we know should be changing the set of run packages (adding a new package, adding a new test type to a package, adding a new test type to the tool), as well as spot-checking when we see unexpected results (e.g., looking back and why a PR didn't fail CI when we discover that it should have). To support better surfacing skips, this restructures the return value of `runForPackage` to have "skip" as one of the options. As a result of it being a return value, packages that used `printSkip` to indicate that *parts* of the command were being skipped have been changed to no longer do that. Fixes https://github.com/flutter/flutter/issues/85626
This commit is contained in:
@ -100,19 +100,20 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
|
||||
'project',
|
||||
getStringArg('project'),
|
||||
]);
|
||||
print('');
|
||||
if (exitCode == 0) {
|
||||
print('\nFirebase project configured.');
|
||||
print('Firebase project configured.');
|
||||
return;
|
||||
} else {
|
||||
print(
|
||||
'\nWarning: gcloud config set returned a non-zero exit code. Continuing anyway.');
|
||||
logWarning(
|
||||
'Warning: gcloud config set returned a non-zero exit code. Continuing anyway.');
|
||||
}
|
||||
}
|
||||
_firebaseProjectConfigured!.complete(null);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> runForPackage(Directory package) async {
|
||||
Future<PackageResult> runForPackage(Directory package) async {
|
||||
if (!package
|
||||
.childDirectory('example')
|
||||
.childDirectory('android')
|
||||
@ -120,29 +121,26 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
|
||||
.childDirectory('src')
|
||||
.childDirectory('androidTest')
|
||||
.existsSync()) {
|
||||
printSkip('No example with androidTest directory');
|
||||
return PackageLoopingCommand.success;
|
||||
return PackageResult.skip('No example with androidTest directory');
|
||||
}
|
||||
|
||||
final List<String> errors = <String>[];
|
||||
|
||||
final Directory exampleDirectory = package.childDirectory('example');
|
||||
final Directory androidDirectory =
|
||||
exampleDirectory.childDirectory('android');
|
||||
|
||||
// Ensures that gradle wrapper exists
|
||||
if (!await _ensureGradleWrapperExists(androidDirectory)) {
|
||||
errors.add('Unable to build example apk');
|
||||
return errors;
|
||||
PackageResult.fail(<String>['Unable to build example apk']);
|
||||
}
|
||||
|
||||
await _configureFirebaseProject();
|
||||
|
||||
if (!await _runGradle(androidDirectory, 'app:assembleAndroidTest')) {
|
||||
errors.add('Unable to assemble androidTest');
|
||||
return errors;
|
||||
PackageResult.fail(<String>['Unable to assemble androidTest']);
|
||||
}
|
||||
|
||||
final List<String> errors = <String>[];
|
||||
|
||||
// Used within the loop to ensure a unique GCS output location for each
|
||||
// test file's run.
|
||||
int resultsCounter = 0;
|
||||
@ -186,7 +184,9 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
|
||||
errors.add('$testName failed tests');
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
return errors.isEmpty
|
||||
? PackageResult.success()
|
||||
: PackageResult.fail(errors);
|
||||
}
|
||||
|
||||
/// Checks that 'gradlew' exists in [androidDirectory], and if not runs a
|
||||
|
Reference in New Issue
Block a user