-
Notifications
You must be signed in to change notification settings - Fork 6
/
health.dart
53 lines (50 loc) · 1.57 KB
/
health.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'package:args/args.dart';
import 'package:firehose/src/health/health.dart';
void main(List<String> arguments) async {
var argParser = ArgParser()
..addOption(
'check',
allowed: checkTypes,
help: 'Check PR health.',
)
..addMultiOption(
'warn_on',
allowed: checkTypes,
help: 'Which checks to display warnings on',
)
..addMultiOption(
'fail_on',
allowed: checkTypes,
help: 'Which checks should lead to workflow failure',
)
..addMultiOption(
'experiments',
help: 'Which experiments should be enabled for Dart',
)
..addFlag(
'coverage_web',
help: 'Whether to run web tests for coverage',
);
var parsedArgs = argParser.parse(arguments);
var check = parsedArgs['check'] as String;
var warnOn = parsedArgs['warn_on'] as List<String>;
var failOn = parsedArgs['fail_on'] as List<String>;
var experiments = parsedArgs['experiments'] as List<String>;
var coverageWeb = parsedArgs['coverage_web'] as bool;
if (warnOn.toSet().intersection(failOn.toSet()).isNotEmpty) {
throw ArgumentError('The checks for which warnings are displayed and the '
'checks which lead to failure must be disjoint.');
}
await Health(
Directory.current,
check,
warnOn,
failOn,
coverageWeb,
experiments,
).healthCheck();
}