Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to health.yaml #310

Merged
merged 34 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
69f6d2e
Test
mosuem Oct 24, 2024
64eacbf
Update health
mosuem Oct 24, 2024
725ce15
always flutter
mosuem Oct 24, 2024
a143250
test
mosuem Oct 24, 2024
fd0bf9b
test
mosuem Oct 24, 2024
1dc88f1
test
mosuem Oct 24, 2024
3b82710
Check all files
mosuem Oct 24, 2024
c82fa4f
fixes
mosuem Oct 24, 2024
3155fec
Use channel and sdk
mosuem Oct 24, 2024
cbdadc3
use in health
mosuem Oct 24, 2024
8656647
change type
mosuem Oct 24, 2024
8f3a03d
Use current firehose
mosuem Oct 24, 2024
67bf2de
Change exception
mosuem Oct 24, 2024
3519e44
do not set exitcode
mosuem Oct 24, 2024
2ebafb5
Update
mosuem Oct 24, 2024
a12c200
Fixes
mosuem Oct 24, 2024
e052ec9
add debug
mosuem Oct 24, 2024
b2bccb1
better log
mosuem Oct 24, 2024
d39459d
more printing
mosuem Oct 24, 2024
123810b
more prints
mosuem Oct 24, 2024
75666ad
Prepare for review
mosuem Oct 24, 2024
eb19356
Add changelog
mosuem Oct 24, 2024
b7610e0
Compare to last published version in breaking check.
mosuem Oct 24, 2024
e0273ea
Fix bug
mosuem Oct 24, 2024
d029581
Update .github/workflows/health_base.yaml
mosuem Oct 31, 2024
3451c8a
Merge branch 'main' into forceFlutter
mosuem Nov 11, 2024
d227021
Echo dart versions
mosuem Nov 14, 2024
1aff275
Use different dart and flutter binaries
mosuem Nov 14, 2024
6970969
Add command
mosuem Nov 14, 2024
3a47a4e
Fixes
mosuem Nov 14, 2024
9035f64
Fix
mosuem Nov 14, 2024
e77901e
Merge branch 'main' into forceFlutter
mosuem Dec 3, 2024
31aaf3f
Fix ref error
mosuem Dec 4, 2024
f1d3680
Fix to covered
mosuem Dec 6, 2024
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
28 changes: 17 additions & 11 deletions .github/workflows/health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ name: Health
# warn_on: "license,coverage,breaking,leaking"
# coverage_web: false
# upload_coverage: false
# use-flutter: true
# flutter_packages: "pkgs/my_flutter_package"
# ignore_license: "**.g.dart"
# ignore_coverage: "**.mock.dart,**.g.dart"
# ignore_packages: "pkgs/helper_package"
Expand All @@ -42,6 +42,12 @@ on:
# parameter is not required; it defaults to `stable` - using the most recent
# stable release of the Dart SDK.
sdk:
description: >-
The Dart SDK version, either a semver or one of `dev`, `stable` etc.
default: "stable"
required: false
type: string
channel:
description: >-
The channel, or a specific version from a channel, to install
('2.19.0','stable', 'beta', 'dev'). Using one of the three channels
Expand Down Expand Up @@ -81,11 +87,11 @@ on:
default: false
type: boolean
required: false
use-flutter:
description: Whether to setup Flutter in this workflow.
default: false
flutter_packages:
description: List of packages depending on Flutter.
default: "\"\""
required: false
type: boolean
type: string
ignore_license:
description: Which files to ignore for the license check.
default: "\"\""
Expand Down Expand Up @@ -122,7 +128,7 @@ jobs:
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
flutter_packages: ${{ inputs.flutter_packages }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}

Expand All @@ -135,7 +141,7 @@ jobs:
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
flutter_packages: ${{ inputs.flutter_packages }}
ignore_license: ${{ inputs.ignore_license }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
Expand All @@ -151,7 +157,7 @@ jobs:
upload_coverage: ${{ inputs.upload_coverage }}
coverage_web: ${{ inputs.coverage_web }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
flutter_packages: ${{ inputs.flutter_packages }}
ignore_coverage: ${{ inputs.ignore_coverage }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}
Expand All @@ -166,7 +172,7 @@ jobs:
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
flutter_packages: ${{ inputs.flutter_packages }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}

Expand All @@ -179,7 +185,7 @@ jobs:
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
flutter_packages: ${{ inputs.flutter_packages }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}

Expand All @@ -192,7 +198,7 @@ jobs:
fail_on: ${{ inputs.fail_on }}
warn_on: ${{ inputs.warn_on }}
local_debug: ${{ inputs.local_debug }}
use-flutter: ${{ inputs.use-flutter }}
flutter_packages: ${{ inputs.flutter_packages }}
ignore_packages: ${{ inputs.ignore_packages }}
checkout_submodules: ${{ inputs.checkout_submodules }}

Expand Down
37 changes: 26 additions & 11 deletions .github/workflows/health_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ on:
default: "stable"
required: false
type: string
channel:
description: >-
The channel, or a specific version from a channel, to install
('2.19.0','stable', 'beta', 'dev'). Using one of the three named channels
will give you the latest version published to that channel.
default: "stable"
required: false
type: string
check:
description: What to check for in the PR health check - any of "changelog,license,coverage,breaking,do-not-submit,leaking"
type: string
Expand Down Expand Up @@ -44,11 +52,11 @@ on:
default: false
type: boolean
required: false
use-flutter:
description: Whether to setup Flutter in this workflow.
default: false
flutter_packages:
description: List of packages depending on Flutter.
default: "\"\""
required: false
type: boolean
type: string
ignore_license:
description: Which files to ignore for the license check.
default: "\"\""
Expand Down Expand Up @@ -98,23 +106,29 @@ jobs:
if: ${{ inputs.check == 'coverage' }} || ${{ inputs.check == 'breaking' }}

- run: mkdir -p current_repo/output/

- uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3
if: ${{ inputs.use-flutter }}
with:
channel: ${{ inputs.sdk }}

- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
if: ${{ !inputs.use-flutter }}
with:
sdk: ${{ inputs.sdk }}

- uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3
if: ${{ inputs.flutter_packages != '' }}
with:
channel: ${{ inputs.channel }}

- name: Check Dart installs whereis
run: whereis dart

- name: Check Dart installs which
run: which dart

- name: Install coverage
run: dart pub global activate coverage
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/ --git-ref=forceFlutter
# DO-NOT-SUBMIT
if: ${{ !inputs.local_debug }}

- name: Install local firehose
Expand All @@ -139,6 +153,7 @@ jobs:
${{ fromJSON('{"true":"--coverage_web","false":""}')[inputs.coverage_web] }} \
--fail_on ${{ inputs.fail_on }} \
--warn_on ${{ inputs.warn_on }} \
--flutter_packages ${{ inputs.flutter_packages }} \
--ignore_license ${{ inputs.ignore_license }} \
--ignore_coverage ${{ inputs.ignore_coverage }} \
--ignore_packages ${{ inputs.ignore_packages }} \
Expand Down
3 changes: 3 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
- Remove the `version` pubspec checks (these largely duplicate the feedback
provided by publishing automation).
- Set minimum SDK version to `3.5.0` because of the `dart_apitool` dependency.
- Run health workflow on all packages if it is changed.
- Specify Flutter packages in the repo, to only have a single workflow file.
- Compare to last published version in breaking check.

## 0.9.3

Expand Down
15 changes: 11 additions & 4 deletions pkgs/firehose/bin/health.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,23 @@ void main(List<String> arguments) async {
..addFlag(
'coverage_web',
help: 'Whether to run web tests for coverage',
)
..addMultiOption(
'flutter_packages',
Copy link
Member

Choose a reason for hiding this comment

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

I see we're using a foo_bar naming convention here and for the other options. I believe a foo-bar convention is more common for args, but likely not worth changing here or being inconsistent w/ the other option names.

defaultsTo: [],
help: 'The Flutter packages in this repo',
);
final parsedArgs = argParser.parse(arguments);
final checkStr = parsedArgs['check'] as String;
final checkStr = parsedArgs.option('check');
final check = Check.values.firstWhere((c) => c.name == checkStr);
final warnOn = parsedArgs['warn_on'] as List<String>;
final failOn = parsedArgs['fail_on'] as List<String>;
final warnOn = parsedArgs.multiOption('warn_on');
final failOn = parsedArgs.multiOption('fail_on');
final flutterPackages = _listNonEmpty(parsedArgs, 'flutter_packages');
final ignorePackages = _listNonEmpty(parsedArgs, 'ignore_packages');
final ignoreLicense = _listNonEmpty(parsedArgs, 'ignore_license');
final ignoreCoverage = _listNonEmpty(parsedArgs, 'ignore_coverage');
final experiments = _listNonEmpty(parsedArgs, 'experiments');
final coverageWeb = parsedArgs['coverage_web'] as bool;
final coverageWeb = parsedArgs.flag('coverage_web');
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.');
Expand All @@ -74,6 +80,7 @@ void main(List<String> arguments) async {
ignoreCoverage,
experiments,
GithubApi(),
flutterPackages,
).healthCheck();
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/lib/firehose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Saving existing comment id $existingCommentId to file ${idFile.path}''');

Future<VerificationResults> verify(GithubApi github) async {
var repo = Repository(directory);
var packages = repo.locatePackages(ignoredPackages);
var packages = repo.locatePackages(ignore: ignoredPackages);

var pub = Pub();

Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/lib/src/health/changelog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Future<Map<Package, List<GitFile>>> packagesWithoutChangelog(
Directory directory,
) async {
final repo = Repository(directory);
final packages = repo.locatePackages(ignoredPackages);
final packages = repo.locatePackages(ignore: ignoredPackages);

final files = await github.listFilesForPR(directory, ignoredPackages);

Expand Down
20 changes: 8 additions & 12 deletions pkgs/firehose/lib/src/health/coverage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,20 @@ class Coverage {
final List<Glob> ignoredPackages;
final Directory directory;
final List<String> experiments;
final String dartExecutable;

Coverage(
this.coverageWeb,
this.ignoredFiles,
this.ignoredPackages,
this.directory,
this.experiments,
this.dartExecutable,
);

Future<CoverageResult> compareCoverages(
GithubApi github, Directory base) async {
var files = await github.listFilesForPR(directory, ignoredFiles);
return compareCoveragesFor(files, base);
}

CoverageResult compareCoveragesFor(List<GitFile> files, Directory base) {
var repository = Repository(directory);
var packages = repository.locatePackages(ignoredPackages);
var packages = repository.locatePackages(ignore: ignoredPackages);
print('Found packages $packages at $directory');

var filesOfInterest = files
Expand All @@ -49,7 +45,7 @@ class Coverage {
print('The files of interest are $filesOfInterest');

var baseRepository = Repository(base);
var basePackages = baseRepository.locatePackages(ignoredFiles);
var basePackages = baseRepository.locatePackages(ignore: ignoredFiles);
print('Found packages $basePackages at $base');

var changedPackages = packages
Expand Down Expand Up @@ -105,7 +101,7 @@ class Coverage {
print('''
Get coverage for ${package.name} by running coverage in ${package.directory.path}''');
Process.runSync(
'dart',
dartExecutable,
[
if (experiments.isNotEmpty)
'--enable-experiment=${experiments.join(',')}',
Expand All @@ -117,7 +113,7 @@ Get coverage for ${package.name} by running coverage in ${package.directory.path
if (coverageWeb) {
print('Run tests with coverage for web');
var resultChrome = Process.runSync(
'dart',
dartExecutable,
[
if (experiments.isNotEmpty)
'--enable-experiment=${experiments.join(',')}',
Expand All @@ -136,7 +132,7 @@ Get coverage for ${package.name} by running coverage in ${package.directory.path

print('Run tests with coverage for vm');
var resultVm = Process.runSync(
'dart',
dartExecutable,
[
if (experiments.isNotEmpty)
'--enable-experiment=${experiments.join(',')}',
Expand All @@ -152,7 +148,7 @@ Get coverage for ${package.name} by running coverage in ${package.directory.path

print('Compute coverage from runs');
var resultLcov = Process.runSync(
'dart',
dartExecutable,
[
'pub',
'global',
Expand Down
Loading
Loading