Skip to content

Commit 3339020

Browse files
authored
Health fixes (#325)
Some more minor fixes for the Health workflow --- - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Most changes should add an entry to the changelog and may need to [rev the pubspec package version](https://github.com/dart-lang/sdk/blob/main/docs/External-Package-Maintenance.md#making-a-change). - Changes to packages require [corresponding tests](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md#Testing). Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback. </details>
1 parent b25118a commit 3339020

File tree

5 files changed

+58
-24
lines changed

5 files changed

+58
-24
lines changed

.github/workflows/health_base.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,13 @@ jobs:
127127
if: ${{ inputs.check == 'coverage' }}
128128

129129
- name: Install firehose
130-
run: dart pub global activate firehose
130+
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
131131
if: ${{ !inputs.local_debug }}
132132

133133
- name: Install local firehose
134134
run: dart pub global activate --source path current_repo/pkgs/firehose/
135135
if: ${{ inputs.local_debug }}
136136

137-
- name: Install api_tool
138-
run: dart pub global activate dart_apitool
139-
if: ${{ inputs.check == 'breaking' || inputs.check == 'leaking' }}
140-
141137
- name: Check PR health
142138
id: healthstep
143139
if: ${{ github.event_name == 'pull_request' }}

pkgs/firehose/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.1
2+
3+
- Small fixes to the PR health checker.
4+
15
## 0.10.0
26

37
- Remove the `version` pubspec checks (these largely duplicate the feedback

pkgs/firehose/lib/src/health/health.dart

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import 'changelog.dart';
1717
import 'coverage.dart';
1818
import 'license.dart';
1919

20+
const apiToolHash = '123049d3fa3c1459a5129b2b61d852a388a8511e';
21+
2022
enum Check {
2123
license('License Headers', 'license'),
2224
changelog('Changelog Entry', 'changelog'),
@@ -151,16 +153,30 @@ class Health {
151153
Future<HealthCheckResult> breakingCheck() async {
152154
final filesInPR = await listFilesInPRorAll(ignoredPackages);
153155
final changeForPackage = <Package, BreakingChange>{};
156+
154157
final flutterPackages =
155158
packagesContaining(filesInPR, only: flutterPackageGlobs);
156-
159+
log('This list of Flutter packages is $flutterPackages');
157160
for (var package
158161
in packagesContaining(filesInPR, ignore: ignoredPackages)) {
159162
log('Look for changes in $package');
160163
var relativePath =
161164
path.relative(package.directory.path, from: directory.path);
162165
var tempDirectory = Directory.systemTemp.createTempSync();
163166
var reportPath = path.join(tempDirectory.path, 'report.json');
167+
168+
runDashProcess(
169+
flutterPackages,
170+
package,
171+
[
172+
'pub',
173+
'global',
174+
'activate',
175+
...['-sgit', 'https://github.com/bmw-tech/dart_apitool.git'],
176+
...['--git-ref', apiToolHash],
177+
],
178+
);
179+
164180
runDashProcess(
165181
flutterPackages,
166182
package,
@@ -210,15 +226,15 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}
210226

211227
ProcessResult runDashProcess(
212228
List<Package> flutterPackages, Package package, List<String> arguments) {
213-
var exec = executable(flutterPackages.contains(package));
229+
var exec = executable(flutterPackages.any((p) => p.name == package.name));
214230
log('Running `$exec ${arguments.join(' ')}` in ${directory.path}');
215231
var runApiTool = Process.runSync(
216232
exec,
217233
arguments,
218234
workingDirectory: directory.path,
219235
);
220-
log(runApiTool.stderr as String);
221-
log(runApiTool.stdout as String);
236+
log('StdOut:\n ${runApiTool.stdout as String}');
237+
log('StdErr:\n ${runApiTool.stderr as String}');
222238
return runApiTool;
223239
}
224240

@@ -242,24 +258,39 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}
242258

243259
final flutterPackages =
244260
packagesContaining(filesInPR, only: flutterPackageGlobs);
261+
log('This list of Flutter packages is $flutterPackages');
245262
for (var package in packagesContaining(filesInPR)) {
246263
log('Look for leaks in $package');
247264
var relativePath =
248265
path.relative(package.directory.path, from: directory.path);
249266
var tempDirectory = Directory.systemTemp.createTempSync();
250267
var reportPath = path.join(tempDirectory.path, 'leaks.json');
251-
var runApiTool = runDashProcess(
268+
269+
runDashProcess(
252270
flutterPackages,
253271
package,
254272
[
255-
...['pub', 'global', 'run'],
256-
'dart_apitool:main',
257-
'extract',
258-
...['--input', relativePath],
259-
...['--output', reportPath],
273+
'pub',
274+
'global',
275+
'activate',
276+
...['-sgit', 'https://github.com/bmw-tech/dart_apitool.git'],
277+
...['--git-ref', apiToolHash],
260278
],
261279
);
262280

281+
var arguments = [
282+
...['pub', 'global', 'run'],
283+
'dart_apitool:main',
284+
'extract',
285+
...['--input', relativePath],
286+
...['--output', reportPath],
287+
];
288+
var runApiTool = runDashProcess(
289+
flutterPackages,
290+
package,
291+
arguments,
292+
);
293+
263294
if (runApiTool.exitCode == 0) {
264295
var fullReportString = await File(reportPath).readAsString();
265296
var decoded = jsonDecode(fullReportString) as Map<String, dynamic>;
@@ -271,14 +302,9 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()}
271302
}
272303
} else {
273304
throw ProcessException(
305+
executable(flutterPackages.contains(package)),
306+
arguments,
274307
'Api tool finished with exit code ${runApiTool.exitCode}',
275-
[
276-
...['pub', 'global', 'run'],
277-
'dart_apitool:main',
278-
'extract',
279-
...['--input', relativePath],
280-
...['--output', reportPath],
281-
],
282308
);
283309
}
284310
}

pkgs/firehose/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: firehose
22
description: A tool to automate publishing of Pub packages from GitHub actions.
3-
version: 0.10.0
3+
version: 0.10.1
44
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose
55

66
environment:

pkgs/firehose/test/health_test.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ Future<void> main() async {
4949
...additional
5050
]);
5151

52-
await Process.run('dart', ['pub', 'global', 'activate', 'dart_apitool']);
52+
await Process.run('dart', [
53+
'pub',
54+
'global',
55+
'activate',
56+
'-sgit',
57+
'https://github.com/bmw-tech/dart_apitool.git',
58+
'--git-ref',
59+
apiToolHash,
60+
]);
5361
await Process.run('dart', ['pub', 'global', 'activate', 'coverage']);
5462
});
5563

0 commit comments

Comments
 (0)