-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[ci] Adds more ci checks for batch release file integrity #10859
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
base: main
Are you sure you want to change the base?
Conversation
3726697 to
a72cb6d
Compare
32a0557 to
dcd190f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request enhances the CI checks for batch release file integrity by adding validation for workflow files, triggers, and branches for packages that opt into batch releases. It also opts in the go_router package to this new system. The changes are well-tested and improve the reliability of the release process. I have a few suggestions to further improve the robustness of the new checks and clean up a minor code duplication issue in the tests.
| if (errors.isNotEmpty) { | ||
| for (final error in errors) { | ||
| printError('$indentation$error'); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return errors; | ||
| } | ||
| final String content = workflowFile.readAsStringSync(); | ||
| final bool hasTrigger = content.contains("- 'release-$packageName'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using String.contains to check for the workflow trigger is brittle. It could incorrectly match a commented-out line or fail to match if the formatting (e.g., quoting) is different. To make this check more robust, you should parse the YAML and inspect the branches list. This would be consistent with how the package-specific workflow file is validated elsewhere in this command.
final YamlMap? yaml = loadYaml(content) as YamlMap?;
final on = yaml?['on'] as YamlMap?;
final push = on?['push'] as YamlMap?;
final branches = push?['branches'] as YamlList?;
final bool hasTrigger = branches?.contains('release-$packageName') ?? false;| @@ -0,0 +1,3 @@ | |||
| changelog: | | |||
| - Converts go_router to use batch release. | |||
| version: patch | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the goal of putting this in a changelog and versioning it? There's no functionality change for clients here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for me to test the feature to ensure the entire workflow works, or do you think we should wait until we have a contribution?
| if (isBatchRelease) { | ||
| if (!batchWorkflowFile.existsSync()) { | ||
| errors.add( | ||
| 'Missing batch workflow file: .github/workflows/${packageName}_batch.yml', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/README.md needs to be updated to describe batched release, and this error message should link to the relevant part of that updated page that explains the process of adopting batched releases (workflow file to add, workflow file to update to list the new package name, config file to add, etc.)
| 'Missing batch workflow file: .github/workflows/${packageName}_batch.yml', | ||
| ); | ||
| } else { | ||
| // Validate content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's a large block of code all to do one conceptual task, that should be extracted to a clearly named and documented helper.
In general, any time code has the pattern:
// Description of what the following code does
<lots of code>
// Description of a new thing that the next section of code does
<lots of code>
...
That's a code smell that there should be smaller functions to do the steps.
also opts in go_router
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3