diff --git a/.github/workflows/health_base.yaml b/.github/workflows/health_base.yaml index 27df6fef..5c7e8b1d 100644 --- a/.github/workflows/health_base.yaml +++ b/.github/workflows/health_base.yaml @@ -127,17 +127,13 @@ jobs: if: ${{ inputs.check == 'coverage' }} - name: Install firehose - run: dart pub global activate firehose + run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/ if: ${{ !inputs.local_debug }} - name: Install local firehose run: dart pub global activate --source path current_repo/pkgs/firehose/ if: ${{ inputs.local_debug }} - - name: Install api_tool - run: dart pub global activate dart_apitool - if: ${{ inputs.check == 'breaking' || inputs.check == 'leaking' }} - - name: Check PR health id: healthstep if: ${{ github.event_name == 'pull_request' }} diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index bf8a747b..9db228f7 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.1 + +- Small fixes to the PR health checker. + ## 0.10.0 - Remove the `version` pubspec checks (these largely duplicate the feedback diff --git a/pkgs/firehose/lib/src/health/health.dart b/pkgs/firehose/lib/src/health/health.dart index 18dd388f..4b96b4f2 100644 --- a/pkgs/firehose/lib/src/health/health.dart +++ b/pkgs/firehose/lib/src/health/health.dart @@ -17,6 +17,8 @@ import 'changelog.dart'; import 'coverage.dart'; import 'license.dart'; +const apiToolHash = '123049d3fa3c1459a5129b2b61d852a388a8511e'; + enum Check { license('License Headers', 'license'), changelog('Changelog Entry', 'changelog'), @@ -151,9 +153,10 @@ class Health { Future breakingCheck() async { final filesInPR = await listFilesInPRorAll(ignoredPackages); final changeForPackage = {}; + final flutterPackages = packagesContaining(filesInPR, only: flutterPackageGlobs); - + log('This list of Flutter packages is $flutterPackages'); for (var package in packagesContaining(filesInPR, ignore: ignoredPackages)) { log('Look for changes in $package'); @@ -161,6 +164,19 @@ class Health { path.relative(package.directory.path, from: directory.path); var tempDirectory = Directory.systemTemp.createTempSync(); var reportPath = path.join(tempDirectory.path, 'report.json'); + + runDashProcess( + flutterPackages, + package, + [ + 'pub', + 'global', + 'activate', + ...['-sgit', 'https://github.com/bmw-tech/dart_apitool.git'], + ...['--git-ref', apiToolHash], + ], + ); + runDashProcess( flutterPackages, package, @@ -210,15 +226,15 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()} ProcessResult runDashProcess( List flutterPackages, Package package, List arguments) { - var exec = executable(flutterPackages.contains(package)); + var exec = executable(flutterPackages.any((p) => p.name == package.name)); log('Running `$exec ${arguments.join(' ')}` in ${directory.path}'); var runApiTool = Process.runSync( exec, arguments, workingDirectory: directory.path, ); - log(runApiTool.stderr as String); - log(runApiTool.stdout as String); + log('StdOut:\n ${runApiTool.stdout as String}'); + log('StdErr:\n ${runApiTool.stderr as String}'); return runApiTool; } @@ -242,24 +258,39 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()} final flutterPackages = packagesContaining(filesInPR, only: flutterPackageGlobs); + log('This list of Flutter packages is $flutterPackages'); for (var package in packagesContaining(filesInPR)) { log('Look for leaks in $package'); var relativePath = path.relative(package.directory.path, from: directory.path); var tempDirectory = Directory.systemTemp.createTempSync(); var reportPath = path.join(tempDirectory.path, 'leaks.json'); - var runApiTool = runDashProcess( + + runDashProcess( flutterPackages, package, [ - ...['pub', 'global', 'run'], - 'dart_apitool:main', - 'extract', - ...['--input', relativePath], - ...['--output', reportPath], + 'pub', + 'global', + 'activate', + ...['-sgit', 'https://github.com/bmw-tech/dart_apitool.git'], + ...['--git-ref', apiToolHash], ], ); + var arguments = [ + ...['pub', 'global', 'run'], + 'dart_apitool:main', + 'extract', + ...['--input', relativePath], + ...['--output', reportPath], + ]; + var runApiTool = runDashProcess( + flutterPackages, + package, + arguments, + ); + if (runApiTool.exitCode == 0) { var fullReportString = await File(reportPath).readAsString(); var decoded = jsonDecode(fullReportString) as Map; @@ -271,14 +302,9 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()} } } else { throw ProcessException( + executable(flutterPackages.contains(package)), + arguments, 'Api tool finished with exit code ${runApiTool.exitCode}', - [ - ...['pub', 'global', 'run'], - 'dart_apitool:main', - 'extract', - ...['--input', relativePath], - ...['--output', reportPath], - ], ); } } diff --git a/pkgs/firehose/pubspec.yaml b/pkgs/firehose/pubspec.yaml index 92b25430..069929f6 100644 --- a/pkgs/firehose/pubspec.yaml +++ b/pkgs/firehose/pubspec.yaml @@ -1,6 +1,6 @@ name: firehose description: A tool to automate publishing of Pub packages from GitHub actions. -version: 0.10.0 +version: 0.10.1 repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose environment: diff --git a/pkgs/firehose/test/health_test.dart b/pkgs/firehose/test/health_test.dart index d17e6db2..7b76fbd0 100644 --- a/pkgs/firehose/test/health_test.dart +++ b/pkgs/firehose/test/health_test.dart @@ -49,7 +49,15 @@ Future main() async { ...additional ]); - await Process.run('dart', ['pub', 'global', 'activate', 'dart_apitool']); + await Process.run('dart', [ + 'pub', + 'global', + 'activate', + '-sgit', + 'https://github.com/bmw-tech/dart_apitool.git', + '--git-ref', + apiToolHash, + ]); await Process.run('dart', ['pub', 'global', 'activate', 'coverage']); });