[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:
stuartmorgan
2021-07-01 16:25:21 -07:00
committed by GitHub
parent 92d6214984
commit edeb10a752
19 changed files with 817 additions and 274 deletions

View File

@ -118,14 +118,13 @@ class DriveExamplesCommand extends PackageLoopingCommand {
}
@override
Future<List<String>> runForPackage(Directory package) async {
Future<PackageResult> runForPackage(Directory package) async {
if (package.basename.endsWith('_platform_interface') &&
!package.childDirectory('example').existsSync()) {
// Platform interface packages generally aren't intended to have
// examples, and don't need integration tests, so skip rather than fail.
printSkip(
'Platform interfaces are not expected to have integratino tests.');
return PackageLoopingCommand.success;
return PackageResult.skip(
'Platform interfaces are not expected to have integration tests.');
}
final List<String> deviceFlags = <String>[];
@ -139,9 +138,8 @@ class DriveExamplesCommand extends PackageLoopingCommand {
}
// If there is no supported target platform, skip the plugin.
if (deviceFlags.isEmpty) {
printSkip(
return PackageResult.skip(
'${getPackageDescription(package)} does not support any requested platform.');
return PackageLoopingCommand.success;
}
int examplesFound = 0;
@ -195,7 +193,9 @@ class DriveExamplesCommand extends PackageLoopingCommand {
printError('No driver tests were run ($examplesFound example(s) found).');
errors.add('No tests ran (use --exclude if this is intentional).');
}
return errors;
return errors.isEmpty
? PackageResult.success()
: PackageResult.fail(errors);
}
Future<List<String>> _getDevicesForPlatform(String platform) async {