Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/current_results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
sdk:
- 3.7.0 # min pubspec SDK
- 3.9.0 # min pubspec SDK
- stable
os:
- ubuntu-latest
Expand Down
14 changes: 6 additions & 8 deletions current_results/bin/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ abstract class GrpcCommand extends Command<void> {
final channel = ClientChannel(
globalResults!['host'],
port: int.parse(globalResults!['port']),
options:
globalResults!['insecure'] == true
? const ChannelOptions(credentials: ChannelCredentials.insecure())
: const ChannelOptions(credentials: ChannelCredentials.secure()),
options: globalResults!['insecure'] == true
? const ChannelOptions(credentials: ChannelCredentials.insecure())
: const ChannelOptions(credentials: ChannelCredentials.secure()),
);

final client = QueryClient(channel);
Expand Down Expand Up @@ -108,10 +107,9 @@ class ListTestsCommand extends GrpcCommand {

@override
Future<void> runWithClient(QueryClient client) async {
final query =
ListTestsRequest()
..prefix = argResults!['prefix']
..limit = int.parse(argResults!['limit']);
final query = ListTestsRequest()
..prefix = argResults!['prefix']
..limit = int.parse(argResults!['limit']);
final result = await client.listTests(query);
print(jsonEncode(result.toProto3Json()));
}
Expand Down
1 change: 1 addition & 0 deletions current_results/lib/protos/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ message Result {
int32 time_ms = 6;
repeated string experiments = 7;
string revision = 8;
optional string id = 9;
}

message ListTestsRequest {
Expand Down
58 changes: 25 additions & 33 deletions current_results/lib/src/bucket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,23 @@ class ResultsBucket {
ResultsBucket(this._bucket);

Future<List<String>> configurationDirectories() async {
final mainDirectories =
await _bucket
.list(prefix: 'configuration/main/')
.where((entry) => entry.isDirectory)
.map((entry) => entry.name)
.toSet();
final mainDirectories = await _bucket
.list(prefix: 'configuration/main/')
.where((entry) => entry.isDirectory)
.map((entry) => entry.name)
.toSet();
// Once all builders have run once on the main branch, this search
// for results from the master branch can be removed.
final masterDirectories =
await _bucket
.list(prefix: 'configuration/master/')
.where((entry) => entry.isDirectory)
.map((entry) => entry.name)
.where(
(name) =>
!mainDirectories.contains(
name.replaceFirst(
'configuration/master/',
'configuration/main/',
),
),
)
.toList();
final masterDirectories = await _bucket
.list(prefix: 'configuration/master/')
.where((entry) => entry.isDirectory)
.map((entry) => entry.name)
.where(
(name) => !mainDirectories.contains(
name.replaceFirst('configuration/master/', 'configuration/main/'),
),
)
.toList();
return [...mainDirectories, ...masterDirectories];
}

Expand All @@ -47,18 +41,16 @@ class ResultsBucket {

Future<List<String>> latestResults(String configurationDirectory) async {
try {
final revision =
await _bucket
.read('${configurationDirectory}latest')
.transform(ascii.decoder)
.transform(LineSplitter())
.single;
final results =
await _bucket
.read('$configurationDirectory$revision/results.json')
.transform(utf8.decoder)
.transform(LineSplitter())
.toList();
final revision = await _bucket
.read('${configurationDirectory}latest')
.transform(ascii.decoder)
.transform(LineSplitter())
.single;
final results = await _bucket
.read('$configurationDirectory$revision/results.json')
.transform(utf8.decoder)
.transform(LineSplitter())
.toList();
return results;
} catch (e) {
print('Error reading results from $configurationDirectory:');
Expand Down
19 changes: 9 additions & 10 deletions current_results/lib/src/result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@ class Result {
uniqueStrings.lookup(string) ??
(uniqueStrings.add(string) ? string : string);

query_api.Result toQueryResult() =>
query_api.Result()
..name = name
..configuration = configuration
..result = result
..timeMs = time.inMilliseconds
..expected = expected
..flaky = flaky
..experiments.addAll(experiments)
..revision = commitHash;
query_api.Result toQueryResult() => query_api.Result()
..name = name
..configuration = configuration
..result = result
..timeMs = time.inMilliseconds
..expected = expected
..flaky = flaky
..experiments.addAll(experiments)
..revision = commitHash;

static query_api.Result toApi(Result result) => result.toQueryResult();

Expand Down
39 changes: 18 additions & 21 deletions current_results/lib/src/slice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ class Slice {

query_api.GetResultsResponse results(query_api.GetResultsRequest query) {
final limit = min(100000, query.pageSize == 0 ? 100000 : query.pageSize);
final pageStart =
query.pageToken.isEmpty ? null : PageStart.parse(query.pageToken);
final pageStart = query.pageToken.isEmpty
? null
: PageStart.parse(query.pageToken);
final filterTerms = query.filter
.split(',')
.map((s) => s.trim())
Expand Down Expand Up @@ -198,14 +199,12 @@ class Slice {
} else {
// Try to find a matching experiment or configuration, or default
// to treating the term as a test prefix.
final matchingExperiments =
_experimentNames
.where((experiment) => experiment.startsWith(filter))
.toSet();
final matchingConfigurations =
_stored.keys
.where((configuration) => configuration.startsWith(filter))
.toSet();
final matchingExperiments = _experimentNames
.where((experiment) => experiment.startsWith(filter))
.toSet();
final matchingConfigurations = _stored.keys
.where((configuration) => configuration.startsWith(filter))
.toSet();
if (matchingExperiments.isNotEmpty) {
experimentNames.addAll(matchingExperiments);
hasExperimentFilter = true;
Expand Down Expand Up @@ -248,11 +247,10 @@ class Slice {
);
response.results.addAll(sortedResults.map(Result.toApi));
if (response.results.length == limit) {
response.nextPageToken =
PageStart(
response.results.last.name,
response.results.last.configuration,
).encode();
response.nextPageToken = PageStart(
response.results.last.name,
response.results.last.configuration,
).encode();
break;
}
}
Expand Down Expand Up @@ -305,12 +303,11 @@ class Slice {
// Optimization
results.addAll(configurationRange.take(needed - results.length));
} else {
results =
merge(
results,
configurationRange,
(Result result) => result.name,
).take(needed).toList();
results = merge(
results,
configurationRange,
(Result result) => result.name,
).take(needed).toList();
}
}
return results;
Expand Down
26 changes: 17 additions & 9 deletions current_results/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.6"
dart_style:
dependency: transitive
description:
name: dart_style
sha256: "5b236382b47ee411741447c1f1e111459c941ea1b3f2b540dde54c210a3662af"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -157,18 +165,18 @@ packages:
dependency: "direct main"
description:
name: googleapis_auth
sha256: befd71383a955535060acde8792e7efc11d2fccd03dd1d3ec434e85b68775938
sha256: b81fe352cc4a330b3710d2b7ad258d9bcef6f909bb759b306bf42973a7d046db
url: "https://pub.dev"
source: hosted
version: "1.6.0"
version: "2.0.0"
grpc:
dependency: "direct main"
description:
name: grpc
sha256: "2dde469ddd8bbd7a33a0765da417abe1ad2142813efce3a86c512041294e2b26"
sha256: "807a4da90fc1ba94dccc3a44653d3ff7bcf26818f030259d6a8f9fab405cb880"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "4.3.1"
http:
dependency: transitive
description:
Expand Down Expand Up @@ -293,18 +301,18 @@ packages:
dependency: "direct main"
description:
name: protobuf
sha256: "579fe5557eae58e3adca2e999e38f02441d8aa908703854a9e0a0f47fa857731"
sha256: "2fcc8a202ca7ec17dab7c97d6b6d91cf03aa07fe6f65f8afbb6dfa52cc5bd902"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "5.1.0"
protoc_plugin:
dependency: "direct dev"
description:
name: protoc_plugin
sha256: "32fbf4ac1b1a7263440898c9011209c3a13c9063f326ef78da83734e6f992ff3"
sha256: d43d92eeec74bf1da8e790570c1ef7cf00cdc47566ad62e2455f1deaab03a22b
url: "https://pub.dev"
source: hosted
version: "22.3.0"
version: "24.0.0"
pub_semver:
dependency: transitive
description:
Expand Down Expand Up @@ -498,4 +506,4 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.7.0 <4.0.0"
dart: ">=3.9.0 <4.0.0"
10 changes: 5 additions & 5 deletions current_results/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ description: Cache and serve the most recent test results from Dart CI.
publish_to: none

environment:
sdk: ^3.7.0
sdk: ^3.9.0

dependencies:
args: ^2.4.2
collection: ^1.18.0
fixnum: ^1.1.0
gcloud: ^0.8.10
googleapis_auth: ^1.4.1
grpc: ^4.0.1
googleapis_auth: ^2.0.0
grpc: ^4.3.1
pool: ^1.5.1
protobuf: ^4.1.0
protobuf: ^5.1.0
shelf: ^1.4.0

dev_dependencies:
lints: ^5.1.1
protoc_plugin: ^22.0.1
protoc_plugin: ^24.0.0
test: ^1.25.0
15 changes: 8 additions & 7 deletions current_results/test/filter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ void filterTest(
..pageToken = ''
..pageSize = 0,
);
final actualResults = groupBy<query_api.Result, String>(
response.results,
(result) => result.configuration,
).map(
(configuration, results) =>
MapEntry(configuration, results.map((r) => r.name).toSet()),
);
final actualResults =
groupBy<query_api.Result, String>(
response.results,
(result) => result.configuration,
).map(
(configuration, results) =>
MapEntry(configuration, results.map((r) => r.name).toSet()),
);

expect(actualResults, equals(expectedResults));
});
Expand Down
7 changes: 3 additions & 4 deletions current_results/test/iterable_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ void main() {
expect((a.iterator..moveNext()).iterable, a.skip(1));
expect([].iterator.iterable, []);
expect(
() =>
a.iterator.iterable
..toList()
..toList(),
() => a.iterator.iterable
..toList()
..toList(),
throwsStateError,
);
expect(a.getRange(1, 2).iterator.iterable.single, 2);
Expand Down
2 changes: 1 addition & 1 deletion current_results_ui/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
exclude: [lib/src/generated/**]
exclude: [lib/src/generated/**, third_party/**]

linter:
rules:
Expand Down
Loading