diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index f2f6950d..a430c702 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -39,16 +39,16 @@ jobs: - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "analyze_and_format; Dart 3.1.0; PKGS: pkgs/corpus, pkgs/firehose; `dart analyze --fatal-infos .`" + name: "analyze_and_format; Dart 3.1.0; PKG: pkgs/corpus; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus-pkgs/firehose;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus;commands:analyze" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus-pkgs/firehose + os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/corpus os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -68,15 +68,6 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps.pkgs_corpus_pub_upgrade.conclusion == 'success'" working-directory: pkgs/corpus - - id: pkgs_firehose_pub_upgrade - name: pkgs/firehose; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/firehose - - name: "pkgs/firehose; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_firehose_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/firehose needs: - job_001 job_003: @@ -144,16 +135,16 @@ jobs: needs: - job_001 job_005: - name: "analyze_and_format; Dart 3.5.0; PKG: pkgs/dart_flutter_team_lints; `dart analyze --fatal-infos .`" + name: "analyze_and_format; Dart 3.5.0; PKGS: pkgs/dart_flutter_team_lints, pkgs/firehose; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints-pkgs/firehose;commands:analyze" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints-pkgs/firehose os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -173,6 +164,15 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps.pkgs_dart_flutter_team_lints_pub_upgrade.conclusion == 'success'" working-directory: pkgs/dart_flutter_team_lints + - id: pkgs_firehose_pub_upgrade + name: pkgs/firehose; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/firehose + - name: "pkgs/firehose; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps.pkgs_firehose_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/firehose needs: - job_001 job_006: @@ -350,35 +350,35 @@ jobs: - job_006 - job_007 job_009: - name: "unit_test; Dart 3.1.0; PKG: pkgs/firehose; `dart test`" + name: "unit_test; Dart 3.4.0; PKG: pkgs/sdk_triage_bot; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/firehose;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/sdk_triage_bot;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0;packages:pkgs/firehose - os:ubuntu-latest;pub-cache-hosted;sdk:3.1.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/sdk_triage_bot + os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.1.0" + sdk: "3.4.0" - id: checkout name: Checkout repository uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - id: pkgs_firehose_pub_upgrade - name: pkgs/firehose; dart pub upgrade + - id: pkgs_sdk_triage_bot_pub_upgrade + name: pkgs/sdk_triage_bot; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/firehose - - name: pkgs/firehose; dart test + working-directory: pkgs/sdk_triage_bot + - name: pkgs/sdk_triage_bot; dart test run: dart test - if: "always() && steps.pkgs_firehose_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/firehose + if: "always() && steps.pkgs_sdk_triage_bot_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/sdk_triage_bot needs: - job_001 - job_002 @@ -388,35 +388,35 @@ jobs: - job_006 - job_007 job_010: - name: "unit_test; Dart 3.4.0; PKG: pkgs/sdk_triage_bot; `dart test`" + name: "unit_test; Dart 3.5.0; PKG: pkgs/dart_flutter_team_lints; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/sdk_triage_bot;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:pkgs/sdk_triage_bot - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0" - id: checkout name: Checkout repository uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - id: pkgs_sdk_triage_bot_pub_upgrade - name: pkgs/sdk_triage_bot; dart pub upgrade + - id: pkgs_dart_flutter_team_lints_pub_upgrade + name: pkgs/dart_flutter_team_lints; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/sdk_triage_bot - - name: pkgs/sdk_triage_bot; dart test + working-directory: pkgs/dart_flutter_team_lints + - name: pkgs/dart_flutter_team_lints; dart test run: dart test - if: "always() && steps.pkgs_sdk_triage_bot_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/sdk_triage_bot + if: "always() && steps.pkgs_dart_flutter_team_lints_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/dart_flutter_team_lints needs: - job_001 - job_002 @@ -426,16 +426,16 @@ jobs: - job_006 - job_007 job_011: - name: "unit_test; Dart 3.5.0; PKG: pkgs/dart_flutter_team_lints; `dart test`" + name: "unit_test; Dart 3.5.0; PKG: pkgs/firehose; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/firehose;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/dart_flutter_team_lints + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:pkgs/firehose os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -446,15 +446,15 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - - id: pkgs_dart_flutter_team_lints_pub_upgrade - name: pkgs/dart_flutter_team_lints; dart pub upgrade + - id: pkgs_firehose_pub_upgrade + name: pkgs/firehose; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/dart_flutter_team_lints - - name: pkgs/dart_flutter_team_lints; dart test + working-directory: pkgs/firehose + - name: pkgs/firehose; dart test run: dart test - if: "always() && steps.pkgs_dart_flutter_team_lints_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/dart_flutter_team_lints + if: "always() && steps.pkgs_firehose_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/firehose needs: - job_001 - job_002 diff --git a/.github/workflows/health.yaml b/.github/workflows/health.yaml index f8d3fe4f..efc2a7b8 100644 --- a/.github/workflows/health.yaml +++ b/.github/workflows/health.yaml @@ -21,8 +21,8 @@ name: Health # uses: dart-lang/ecosystem/.github/workflows/health.yaml@main # with: # sdk: beta -# checks: "version,changelog,license,coverage,breaking,do-not-submit,leaking" -# fail_on: "version,changelog,do-not-submit" +# checks: "changelog,license,coverage,breaking,do-not-submit,leaking" +# fail_on: "changelog,do-not-submit" # warn_on: "license,coverage,breaking,leaking" # coverage_web: false # upload_coverage: false @@ -52,17 +52,17 @@ on: # Restrict the checks to any subset of version, changelog, and license if # needed. checks: - description: What to check for in the PR health check - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" - default: "version,changelog,license,coverage,breaking,do-not-submit,leaking" + description: What to check for in the PR health check - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking" + default: "changelog,license,coverage,breaking,do-not-submit,leaking" type: string required: false fail_on: - description: Which checks should lead to failure - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" - default: "version,changelog,do-not-submit" + description: Which checks should lead to failure - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking" + default: "changelog,do-not-submit" type: string required: false warn_on: - description: Which checks should not fail, but only warn - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" + description: Which checks should not fail, but only warn - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking" default: "license,coverage,breaking,leaking" type: string required: false @@ -113,19 +113,6 @@ on: required: false jobs: - version: - if: ${{ contains(inputs.checks, 'version') }} - uses: ./.github/workflows/health_base.yaml - with: - sdk: ${{ inputs.sdk }} - check: version - fail_on: ${{ inputs.fail_on }} - warn_on: ${{ inputs.warn_on }} - local_debug: ${{ inputs.local_debug }} - use-flutter: ${{ inputs.use-flutter }} - ignore_packages: ${{ inputs.ignore_packages }} - checkout_submodules: ${{ inputs.checkout_submodules }} - changelog: if: ${{ contains(inputs.checks, 'changelog') }} uses: ./.github/workflows/health_base.yaml @@ -210,7 +197,7 @@ jobs: checkout_submodules: ${{ inputs.checkout_submodules }} comment: - needs: [version, changelog, license, coverage, breaking, do-not-submit, leaking] + needs: [changelog, license, coverage, breaking, do-not-submit, leaking] if: always() # These permissions are required for us to create comments on PRs. permissions: diff --git a/.github/workflows/health_base.yaml b/.github/workflows/health_base.yaml index 957ed66a..3bbb3890 100644 --- a/.github/workflows/health_base.yaml +++ b/.github/workflows/health_base.yaml @@ -16,16 +16,16 @@ on: required: false type: string check: - description: What to check for in the PR health check - any of "version,changelog,license,coverage,breaking,do-not-submit,leaking" + description: What to check for in the PR health check - any of "changelog,license,coverage,breaking,do-not-submit,leaking" type: string required: true fail_on: - description: Which checks should lead to failure - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" - default: "version,changelog,do-not-submit" + description: Which checks should lead to failure - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking" + default: "changelog,do-not-submit" type: string required: false warn_on: - description: Which checks should not fail, but only warn - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" + description: Which checks should not fail, but only warn - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking" default: "license,coverage,breaking,leaking" type: string required: false diff --git a/.github/workflows/health_internal.yaml b/.github/workflows/health_internal.yaml index 26ed3ceb..37e2a62c 100644 --- a/.github/workflows/health_internal.yaml +++ b/.github/workflows/health_internal.yaml @@ -12,8 +12,8 @@ jobs: local_debug: true coverage_web: false upload_coverage: false - checks: version,changelog,license,coverage,breaking,do-not-submit,leaking - fail_on: version,changelog,do-not-submit + checks: changelog,license,coverage,breaking,do-not-submit,leaking + fail_on: changelog,do-not-submit warn_on: license,coverage,breaking,leaking ignore_license: 'pkgs/firehose/test_data' ignore_coverage: 'pkgs/firehose/bin,pkgs/firehose/test_data' diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index fa424963..6890c0d0 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.10.0 + +- Remove the `version` pubspec checks (these largely duplicate the feedback + provided by publishing automation). + ## 0.9.3 - Do not check Dart SDK in PR Health breaking check. diff --git a/pkgs/firehose/lib/src/health/health.dart b/pkgs/firehose/lib/src/health/health.dart index 042abd5a..8850519d 100644 --- a/pkgs/firehose/lib/src/health/health.dart +++ b/pkgs/firehose/lib/src/health/health.dart @@ -2,8 +2,6 @@ // 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. -// ignore_for_file: always_declare_return_types - import 'dart:convert'; import 'dart:io'; import 'dart:math'; @@ -20,7 +18,6 @@ import 'coverage.dart'; import 'license.dart'; enum Check { - version('Package publish validation', 'version'), license('License Headers', 'license'), changelog('Changelog Entry', 'changelog'), coverage('Coverage', 'coverage'), @@ -53,6 +50,7 @@ class Health { this.github, { Directory? base, String? comment, + this.log = printLogger, }) : ignoredPackages = ignoredPackages .map((pattern) => Glob(pattern, recursive: true)) .toList(), @@ -80,6 +78,7 @@ class Health { final List ignoredFilesForCoverage; final Directory baseDirectory; final List experiments; + final Logger log; Future healthCheck() async { // Do basic validation of our expected env var. @@ -88,16 +87,16 @@ class Health { if (!expectEnv(github.sha, 'GITHUB_SHA')) return; var checkName = check.name; - print('Start health check for the check $checkName with'); - print(' warnOn: $warnOn'); - print(' failOn: $failOn'); - print(' coverageweb: $coverageweb'); - print(' ignoredPackages: $ignoredPackages'); - print(' ignoredForLicense: $ignoredFilesForLicense'); - print(' ignoredForCoverage: $ignoredFilesForCoverage'); - print(' baseDirectory: $baseDirectory'); - print(' experiments: $experiments'); - print('Checking for $checkName'); + log('Start health check for the check $checkName with'); + log(' warnOn: $warnOn'); + log(' failOn: $failOn'); + log(' coverageweb: $coverageweb'); + log(' ignoredPackages: $ignoredPackages'); + log(' ignoredForLicense: $ignoredFilesForLicense'); + log(' ignoredForCoverage: $ignoredFilesForCoverage'); + log(' baseDirectory: $baseDirectory'); + log(' experiments: $experiments'); + log('Checking for $checkName'); if (!github.prLabels.contains('skip-$checkName-check')) { final firstResult = await checkFor(check)(); final HealthCheckResult finalResult; @@ -112,14 +111,13 @@ class Health { } await writeInComment(github, finalResult); var severity = finalResult.severity.name.toUpperCase(); - print('\n\n$severity: $checkName done.\n\n'); + log('\n\n$severity: $checkName done.\n\n'); } else { - print('Skipping $checkName, as the skip tag is present.'); + log('Skipping $checkName, as the skip tag is present.'); } } Future Function() checkFor(Check check) => switch (check) { - Check.version => validateCheck, Check.license => licenseCheck, Check.changelog => changelogCheck, Check.coverage => coverageCheck, @@ -128,31 +126,11 @@ class Health { Check.leaking => leakingCheck, }; - Future validateCheck() async { - //TODO: Add Flutter support for PR health checks - var results = - await Firehose(directory, false, ignoredPackages).verify(github); - - var markdownTable = ''' -| Package | Version | Status | -| :--- | ---: | :--- | -${results.describeAsMarkdown(withTag: false)} - -Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. - '''; - - return HealthCheckResult( - Check.version, - results.severity, - markdownTable, - ); - } - Future breakingCheck() async { final filesInPR = await github.listFilesForPR(directory, ignoredPackages); final changeForPackage = {}; for (var package in packagesContaining(filesInPR, ignoredPackages)) { - print('Look for changes in $package with base $baseDirectory'); + log('Look for changes in $package with base $baseDirectory'); var relativePath = path.relative(package.directory.path, from: directory.path); var baseRelativePath = path.relative( @@ -174,15 +152,15 @@ Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automati ], workingDirectory: directory.path, ); - print(runApiTool.stderr); - print(runApiTool.stdout); + log(runApiTool.stderr as String); + log(runApiTool.stdout as String); var fullReportString = File(reportPath).readAsStringSync(); var decoded = jsonDecode(fullReportString) as Map; var report = decoded['report'] as Map; var formattedChanges = const JsonEncoder.withIndent(' ').convert(report); - print('Breaking change report:\n$formattedChanges'); + log('Breaking change report:\n$formattedChanges'); final versionMap = decoded['version'] as Map; changeForPackage[package] = BreakingChange( @@ -225,7 +203,7 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()} final filesInPR = await github.listFilesForPR(directory, ignoredPackages); final leaksForPackage = >{}; for (var package in packagesContaining(filesInPR, ignoredPackages)) { - print('Look for leaks in $package'); + log('Look for leaks in $package'); var relativePath = path.relative(package.directory.path, from: directory.path); var tempDirectory = Directory.systemTemp.createTempSync(); @@ -242,14 +220,14 @@ ${changeForPackage.entries.map((e) => '|${e.key.name}|${e.value.toMarkdownRow()} ], workingDirectory: directory.path, ); - print(runApiTool.stderr); - print(runApiTool.stdout); + log(runApiTool.stderr as String); + log(runApiTool.stdout as String); var fullReportString = File(reportPath).readAsStringSync(); var decoded = jsonDecode(fullReportString) as Map; var leaks = decoded['missingEntryPoints'] as List; - print('Leaking symbols in API:\n$leaks'); + log('Leaking symbols in API:\n$leaks'); if (leaks.isNotEmpty) { leaksForPackage[package] = leaks.cast(); } @@ -345,7 +323,7 @@ Changes to files need to be [accounted for](https://github.com/dart-lang/ecosyst final body = await github.pullrequestBody(); final files = await github.listFilesForPR(directory, ignoredPackages); - print('Checking for DO_NOT${'_'}SUBMIT strings: $files'); + log('Checking for DO_NOT${'_'}SUBMIT strings: $files'); final filesWithDNS = files .where((file) => ![FileStatus.removed, FileStatus.unchanged].contains(file.status)) @@ -355,10 +333,10 @@ Changes to files need to be [accounted for](https://github.com/dart-lang/ecosyst .readAsStringSync() .contains('DO_NOT${'_'}SUBMIT')) .toList(); - print('Found files with $dns: $filesWithDNS'); + log('Found files with $dns: $filesWithDNS'); final bodyContainsDNS = body.contains(dns); - print('The body contains a $dns string: $bodyContainsDNS'); + log('The body contains a $dns string: $bodyContainsDNS'); final markdownResult = ''' Body contains `$dns`: $bodyContainsDNS @@ -427,7 +405,7 @@ ${isWorseThanInfo ? 'This check can be disabled by tagging the PR with `skip-${r github.appendStepSummary(markdownSummary); var commentFile = File(commentPath); - print('Saving comment markdown to file ${commentFile.path}'); + log('Saving comment markdown to file ${commentFile.path}'); await commentFile.create(recursive: true); await commentFile.writeAsString(markdownSummary); diff --git a/pkgs/firehose/lib/src/utils.dart b/pkgs/firehose/lib/src/utils.dart index bcc5d7c3..d29c9896 100644 --- a/pkgs/firehose/lib/src/utils.dart +++ b/pkgs/firehose/lib/src/utils.dart @@ -111,6 +111,10 @@ bool expectEnv(String? value, String name) { } } +typedef Logger = void Function(String message); + +const Logger printLogger = print; + enum Severity { success(':heavy_check_mark:'), info(':heavy_check_mark:'), diff --git a/pkgs/firehose/pubspec.yaml b/pkgs/firehose/pubspec.yaml index 2b83244f..92b25430 100644 --- a/pkgs/firehose/pubspec.yaml +++ b/pkgs/firehose/pubspec.yaml @@ -1,10 +1,10 @@ name: firehose description: A tool to automate publishing of Pub packages from GitHub actions. -version: 0.9.3 +version: 0.10.0 repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose environment: - sdk: ^3.1.0 + sdk: ^3.5.0 executables: firehose: firehose diff --git a/pkgs/firehose/test/health_test.dart b/pkgs/firehose/test/health_test.dart index 8ab040d5..455331bd 100644 --- a/pkgs/firehose/test/health_test.dart +++ b/pkgs/firehose/test/health_test.dart @@ -13,36 +13,42 @@ import 'package:path/path.dart' as p; import 'package:test/test.dart'; Future main() async { - final directory = Directory(p.join('test_data', 'test_repo')); - var fakeGithubApi = FakeGithubApi(prLabels: [], files: [ - GitFile( - 'pkgs/package1/bin/package1.dart', - FileStatus.modified, - directory, - ), - GitFile( - 'pkgs/package2/lib/anotherLib.dart', - FileStatus.added, - directory, - ), - GitFile( - 'pkgs/package2/someImage.png', - FileStatus.added, - directory, - ), - GitFile( - 'pkgs/package5/lib/src/package5_base.dart', - FileStatus.modified, - directory, - ), - GitFile( - 'pkgs/package5/pubspec.yaml', - FileStatus.modified, - directory, - ), - ]); - await Process.run('dart', ['pub', 'global', 'activate', 'dart_apitool']); - await Process.run('dart', ['pub', 'global', 'activate', 'coverage']); + late final Directory directory; + late final FakeGithubApi fakeGithubApi; + + setUpAll(() async { + directory = Directory(p.join('test_data', 'test_repo')); + fakeGithubApi = FakeGithubApi(prLabels: [], files: [ + GitFile( + 'pkgs/package1/bin/package1.dart', + FileStatus.modified, + directory, + ), + GitFile( + 'pkgs/package2/lib/anotherLib.dart', + FileStatus.added, + directory, + ), + GitFile( + 'pkgs/package2/someImage.png', + FileStatus.added, + directory, + ), + GitFile( + 'pkgs/package5/lib/src/package5_base.dart', + FileStatus.modified, + directory, + ), + GitFile( + 'pkgs/package5/pubspec.yaml', + FileStatus.modified, + directory, + ), + ]); + + await Process.run('dart', ['pub', 'global', 'activate', 'dart_apitool']); + await Process.run('dart', ['pub', 'global', 'activate', 'coverage']); + }); for (var check in Check.values) { test( @@ -102,6 +108,7 @@ Future checkGolden( fakeGithubApi, base: Directory(p.join('test_data', 'base_test_repo')), comment: commentPath, + log: printOnFailure, ).healthCheck(); var comment = await File(commentPath).readAsString(); var goldenFile = diff --git a/pkgs/firehose/test_data/golden/comment_version.md b/pkgs/firehose/test_data/golden/comment_version.md deleted file mode 100644 index c8835af5..00000000 --- a/pkgs/firehose/test_data/golden/comment_version.md +++ /dev/null @@ -1,18 +0,0 @@ -
- -Package publish validation :exclamation: - - -| Package | Version | Status | -| :--- | ---: | :--- | -| package:package1 | 1.0.0 | (error) pub publish dry-run failed; add the `publish-ignore-warnings` label to ignore | -| package:package2 | 1.0.0 | (error) pub publish dry-run failed; add the `publish-ignore-warnings` label to ignore | -| package:package3 | 1.0.0 | (error) pub publish dry-run failed; add the `publish-ignore-warnings` label to ignore | -| package:package5 | 1.2.0 | (error) pubspec version (1.2.0) and changelog (null) don't agree | - -Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. - - -This check can be disabled by tagging the PR with `skip-version-check`. -
- diff --git a/pkgs/firehose/test_data/golden/comment_version_ignore_package.md b/pkgs/firehose/test_data/golden/comment_version_ignore_package.md deleted file mode 100644 index 376e1d94..00000000 --- a/pkgs/firehose/test_data/golden/comment_version_ignore_package.md +++ /dev/null @@ -1,17 +0,0 @@ -
- -Package publish validation :exclamation: - - -| Package | Version | Status | -| :--- | ---: | :--- | -| package:package2 | 1.0.0 | (error) pub publish dry-run failed; add the `publish-ignore-warnings` label to ignore | -| package:package3 | 1.0.0 | (error) pub publish dry-run failed; add the `publish-ignore-warnings` label to ignore | -| package:package5 | 1.2.0 | (error) pubspec version (1.2.0) and changelog (null) don't agree | - -Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. - - -This check can be disabled by tagging the PR with `skip-version-check`. -
-