Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[flutter_plugin_tools] Check for missing version and CHANGELOG updates #4530

Merged

Conversation

stuartmorgan
Copy link
Contributor

The currently documented repository policy is to:

  • require version updates for packages changes that don't meet specific exemptions, and
  • require CHANGELOG changes for essentially all changes.

This adds tooling that enforces that policy, with a mechanism for overriding it via PR descriptions, to avoid cases where they are accidentally omitted without reviewers catching it.

In order to facilitate testing (which require mocking another git command), this also updates the existing version-check tests:

  • Replaces the custom git result injection/validating with the newer bind-to-process-mocks approach that is now used in the rest of the tool tests.
  • Fixes some tests that were only checking for ToolExit to also check the error output, in order to ensure that failure tests are not accidentally passing for the wrong reason (as is being done in general as tests in the tooling are updated).

Fixes flutter/flutter#93790

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Comment on lines 167 to 169
late GitVersionFinder _gitVersionFinder;
late String _mergeBase;
late List<String> _changedFiles;
Copy link
Member

Choose a reason for hiding this comment

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

These can be late final since they are only set once, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, done.

Comment on lines +187 to +189
_gitVersionFinder = await retrieveVersionFinder();
_mergeBase = await _gitVersionFinder.getBaseSha();
_changedFiles = await _gitVersionFinder.getChangedFiles();
Copy link
Member

Choose a reason for hiding this comment

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

nit: These could be parallelized, right? No need to serialize them.

mergeBase = _gitVersionFinder.getBaseSha().then((x) { _mergeBase = x; });
...
await Futures.wait([mergeBase, changedFiles])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In theory yes, but getChangedFiles needs the base SHA, so it would make the code more complex without actually changing anything.

@stuartmorgan
Copy link
Contributor Author

submit-queue incorrectly showing red; landing.

@stuartmorgan stuartmorgan merged commit a10b89e into flutter:master Nov 23, 2021
@stuartmorgan stuartmorgan deleted the version-changelog-verification branch November 23, 2021 16:34
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 23, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Dec 11, 2021
flutter#4530)

The currently documented repository policy is to:
- require version updates for packages changes that don't meet specific exemptions, and
- require CHANGELOG changes for essentially all changes.

This adds tooling that enforces that policy, with a mechanism for overriding it via PR descriptions, to avoid cases where they are accidentally omitted without reviewers catching it.

In order to facilitate testing (which require mocking another `git` command), this also updates the existing `version-check` tests:
- Replaces the custom git result injection/validating with the newer bind-to-process-mocks approach that is now used in the rest of the tool tests.
- Fixes some tests that were only checking for `ToolExit` to also check the error output, in order to ensure that failure tests are not accidentally passing for the wrong reason (as is being done in general as tests in the tooling are updated).

Fixes flutter/flutter#93790
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
flutter#4530)

The currently documented repository policy is to:
- require version updates for packages changes that don't meet specific exemptions, and
- require CHANGELOG changes for essentially all changes.

This adds tooling that enforces that policy, with a mechanism for overriding it via PR descriptions, to avoid cases where they are accidentally omitted without reviewers catching it.

In order to facilitate testing (which require mocking another `git` command), this also updates the existing `version-check` tests:
- Replaces the custom git result injection/validating with the newer bind-to-process-mocks approach that is now used in the rest of the tool tests.
- Fixes some tests that were only checking for `ToolExit` to also check the error output, in order to ensure that failure tests are not accidentally passing for the wrong reason (as is being done in general as tests in the tooling are updated).

Fixes flutter/flutter#93790
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[flutter_plugin_tools] Add a check for version and CHANGELOG updates
2 participants