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: 2 additions & 0 deletions .github/workflows/firehose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ jobs:
if: ${{ matrix.sdk == 'stable' }}

- run: dart test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ on:
default: "\"\""
type: string
required: false
health_yaml_name:
description: The name of the workflow file.
default: '""'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a default here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like below we default to checking for health.yaml or health.yml. Separately, it might be nice to figure out which of those extensions is more common, and only support that (health.yaml?).

type: string
required: false

jobs:
changelog:
Expand All @@ -156,6 +161,7 @@ jobs:
ignore_changelog: ${{ inputs.ignore_changelog }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
health_yaml_name: ${{ inputs.health_yaml_name }}

license:
if: ${{ contains(inputs.checks, 'license') }}
Expand All @@ -170,6 +176,7 @@ jobs:
ignore_license: ${{ inputs.ignore_license }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
health_yaml_name: ${{ inputs.health_yaml_name }}

coverage:
if: ${{ contains(inputs.checks, 'coverage') }}
Expand All @@ -187,6 +194,7 @@ jobs:
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
experiments: ${{ inputs.experiments }}
health_yaml_name: ${{ inputs.health_yaml_name }}

breaking:
if: ${{ contains(inputs.checks, 'breaking') }}
Expand All @@ -201,6 +209,7 @@ jobs:
ignore_breaking: ${{ inputs.ignore_breaking }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
health_yaml_name: ${{ inputs.health_yaml_name }}

do-not-submit:
if: ${{ contains(inputs.checks, 'do-not-submit') }}
Expand All @@ -215,6 +224,7 @@ jobs:
ignore_donotsubmit: ${{ inputs.ignore_donotsubmit }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
health_yaml_name: ${{ inputs.health_yaml_name }}

leaking:
if: ${{ contains(inputs.checks, 'leaking') }}
Expand All @@ -229,6 +239,7 @@ jobs:
ignore_leaking: ${{ inputs.ignore_leaking }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
health_yaml_name: ${{ inputs.health_yaml_name }}

comment:
needs: [changelog, license, coverage, breaking, do-not-submit, leaking]
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/health_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ on:
default: '""'
type: string
required: false
health_yaml_name:
description: The name of the workflow file.
default: '""'
type: string
required: false

jobs:
health:
Expand Down Expand Up @@ -189,7 +194,8 @@ jobs:
--ignore_breaking ${{ inputs.ignore_breaking }} \
--ignore_leaking ${{ inputs.ignore_leaking }} \
--ignore_donotsubmit ${{ inputs.ignore_donotsubmit }} \
--experiments ${{ inputs.experiments }}
--experiments ${{ inputs.experiments }} \
--health_yaml_name ${{ inputs.health_yaml_name }}

- run: test -f current_repo/output/comment.md || echo $'The ${{ inputs.check }} workflow has encountered an exception and did not complete.' >> current_repo/output/comment.md
if: ${{ '$action_state' == 1 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/health_internal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ jobs:
warn_on: license,coverage,breaking,leaking
ignore_license: 'pkgs/firehose/test_data'
ignore_coverage: 'pkgs/firehose/bin,pkgs/firehose/test_data'
health_yaml_name: 'health_internal.yaml'
permissions:
pull-requests: write
4 changes: 4 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.12.0

- Make the location of the health.yaml workflow configurable.

## 0.11.0

- Bump dart_apitool which can now report leak locations.
Expand Down
24 changes: 12 additions & 12 deletions pkgs/firehose/bin/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ void main(List<String> arguments) async {
'flutter_packages',
defaultsTo: [],
help: 'The Flutter packages in this repo',
)
..addOption(
'health_yaml_name',
help: 'The name of the workflow file containing the health checks, '
'to know to rerun all checks if that file is changed.',
);
for (var check in Check.values) {
argParser.addMultiOption(
Expand All @@ -62,22 +67,17 @@ void main(List<String> arguments) async {
.map((c) => MapEntry(c, _listNonEmpty(parsedArgs, 'ignore_${c.name}'))));
final experiments = _listNonEmpty(parsedArgs, 'experiments');
final coverageWeb = parsedArgs.flag('coverage_web');
var healthYamlName = parsedArgs.option('health_yaml_name');
final healthYamlNames =
healthYamlName != null ? {healthYamlName} : {'health.yaml', 'health.yml'};
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,
ignorePackages,
ignoredFor,
experiments,
GithubApi(),
flutterPackages,
).healthCheck();
await Health(Directory.current, check, warnOn, failOn, coverageWeb,
ignorePackages, ignoredFor, experiments, GithubApi(), flutterPackages,
healthYamlNames: healthYamlNames)
.healthCheck();
}

List<String> _listNonEmpty(ArgResults parsedArgs, String key) =>
Expand Down
7 changes: 4 additions & 3 deletions pkgs/firehose/lib/src/health/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Health {
Directory? base,
String? comment,
this.log = printLogger,
required this.healthYamlNames,
}) : ignoredPackages = toGlobs(ignoredPackages),
flutterPackageGlobs = toGlobs(flutterPackages),
ignoredFor =
Expand Down Expand Up @@ -94,6 +95,7 @@ class Health {
final Directory baseDirectory;
final List<String> experiments;
final Logger log;
final Set<String> healthYamlNames;

late final String dartExecutable;
late final String? flutterExecutable;
Expand All @@ -119,6 +121,7 @@ class Health {
log(' ignoredFor: $ignoredFor');
log(' baseDirectory: $baseDirectory');
log(' experiments: $experiments');
log(' healthYamlNames: $healthYamlNames');
log('Checking for $checkName');
if (!github.prLabels.contains('skip-$checkName-check')) {
final firstResult = await checkFor(check)();
Expand Down Expand Up @@ -395,9 +398,7 @@ ${unchangedFilesPaths.isNotEmpty ? unchangedMarkdown : ''}
bool healthYamlChanged(List<GitFile> files) => files
.where((file) =>
[FileStatus.added, FileStatus.modified].contains(file.status))
.any((file) =>
file.filename.endsWith('health.yaml') ||
file.filename.endsWith('health.yml'));
.any((file) => healthYamlNames.contains(path.basename(file.filename)));

Future<HealthCheckResult> changelogCheck() async {
var filePaths = await packagesWithoutChangelog(
Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
version: 0.11.0
version: 0.12.0
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose

environment:
Expand Down
4 changes: 2 additions & 2 deletions pkgs/firehose/test/health_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Future<void> main() async {
check,
fakeGithubApi([
GitFile(
'.github/workflows/health.yaml',
'.github/workflows/my_health.yaml',
FileStatus.added,
directory,
),
Expand Down Expand Up @@ -170,7 +170,7 @@ class FakeHealth extends Health {
super.base,
super.comment,
super.log,
});
}) : super(healthYamlNames: {'my_health.yaml'});

@override
String getCurrentVersionOfPackage(Package package) =>
Expand Down
Loading