diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..a741c15ac85 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,33 @@ +*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.* + +*List which issues are fixed by this PR. You must list at least one issue.* + +*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* + + + + +## 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 the [Flutter Style Guide] _recently_, and have followed its advice. +- [ ] I signed the [CLA]. +- [ ] I listed at least one issue that this PR fixes in the description above. +- [ ] 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. + +If you need help, consider asking for advice on the #hackers-new channel on [Discord]. + + +[Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview +[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene +[test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests +[Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo +[CLA]: https://cla.developers.google.com/ +[flutter/tests]: https://github.com/flutter/tests +[breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes +[Discord]: https://github.com/flutter/flutter/wiki/Chat \ No newline at end of file diff --git a/.github/workflows/release-notes.yaml b/.github/workflows/release-notes.yaml new file mode 100644 index 00000000000..f9c6fe984ab --- /dev/null +++ b/.github/workflows/release-notes.yaml @@ -0,0 +1,57 @@ +name: Release Notes + +on: + pull_request: + types: [ assigned, opened, synchronize, reopened, edited ] +env: + CURRENT_RELEASE_JSON_FILE_PATH: tool/release_notes/NEXT_RELEASE_NOTES.md +jobs: + release-preparedness: + runs-on: ubuntu-latest + name: Verify PR Release Note Requirements + steps: + + - name: Get Pull Request Number + id: get-pull-request-number + run: | + PULL_REQUEST_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") + echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> $GITHUB_OUTPUT + + - name: Check if we have modified release note file + id: get-modified-files + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}} + run: | + FILES_RESPONSE=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER/files) + echo "FILES_RESPONSE: $FILES_RESPONSE" + + HAS_CHANGED_RELEASE_NOTES=$(echo $FILES_RESPONSE | jq '.[].filename' | jq -s '. | any(. == env.CURRENT_RELEASE_JSON_FILE_PATH)') + echo "HAS_CHANGED_RELEASE_NOTES=$HAS_CHANGED_RELEASE_NOTES" >> $GITHUB_OUTPUT + + - name: Get PR Description + id: check-release-note-exceptions + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}} + run: | + PULLS_RESPONSE=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER) + DESCRIPTION_BODY=$(echo $PULLS_RESPONSE | jq '.body') + echo $DESCRIPTION_BODY + if $(echo $DESCRIPTION_BODY | grep -Eq "RELEASE_NOTE_EXCEPTION="); then + HAS_RELEASE_NOTE_EXCEPTION_STRING=true + else + HAS_RELEASE_NOTE_EXCEPTION_STRING=false + fi + echo "HAS_RELEASE_NOTE_EXCEPTION_STRING=$HAS_RELEASE_NOTE_EXCEPTION_STRING" >> $GITHUB_OUTPUT + + - name: Check Release Preparedness requirements + env: + HAS_CHANGED_RELEASE_NOTES: ${{steps.get-modified-files.outputs.HAS_CHANGED_RELEASE_NOTES}} + HAS_RELEASE_NOTE_EXCEPTION_STRING: ${{steps.check-release-note-exceptions.outputs.HAS_RELEASE_NOTE_EXCEPTION_STRING}} + run: | + if [ "$HAS_CHANGED_RELEASE_NOTES" != "true" ] && [ "$HAS_RELEASE_NOTE_EXCEPTION_STRING" != "true" ] ; then + echo "Release Preparedness check failed" + echo "::error file=$CURRENT_RELEASE_JSON_FILE_PATH,line=0,col=0,endColumn=0,title='Release Notes Weren\'t Modified'::Please add a release note entry or a reason to your description using: \`RELEASE_NOTE_EXCEPTION=[reason goes here]\`" + exit 1 + fi diff --git a/packages/devtools_app/lib/src/framework/release_notes/README.md b/packages/devtools_app/lib/src/framework/release_notes/README.md index 81a6b4f82a5..210074f300b 100644 --- a/packages/devtools_app/lib/src/framework/release_notes/README.md +++ b/packages/devtools_app/lib/src/framework/release_notes/README.md @@ -1,9 +1,9 @@ -## Writing DevTools release notes +## Generating Release notes - Release notes for DevTools are hosted on the flutter website (see [archive](https://docs.flutter.dev/development/tools/devtools/release-notes)). -- To add release notes for the latest release, create a PR with the appropriate changes for your release - - The [release notes template](release-notes-template.md) can be used as a starting point - - see example [PR](https://github.com/flutter/website/pull/6791). +- To add release notes for the latest release, create a PR with the appropriate changes for your release. + - To generate the release notes run: + `dart tool/release_note_helper.dart markdown -f tool/release_notes/release_notes.json` - Test these changes locally before creating the PR. - See [README.md](https://github.com/flutter/website/blob/main/README.md) for getting setup to run the Flutter website locally. diff --git a/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart b/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart index 5a4b994a993..5b4a15f3b73 100644 --- a/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart +++ b/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart @@ -84,7 +84,7 @@ class InspectorScreenBodyState extends State SearchTargetType searchTarget = SearchTargetType.widget; - static const summaryTreeKey = Key('Summary Tree'); + static const summaryTreeKey = Key('Summary Tree DAKE'); static const detailsTreeKey = Key('Details Tree'); static const minScreenWidthForTextBeforeScaling = 900.0; static const unscaledIncludeRefreshTreeWidth = 1255.0; diff --git a/tool/README.md b/tool/README.md index 2032e32f815..45e8024115f 100644 --- a/tool/README.md +++ b/tool/README.md @@ -33,7 +33,27 @@ git checkout -b release_$(date +%s); #### Update the DevTools version number +##### Releasing a clean version Run the `tool/update_version.dart` script to update the DevTools version. +- When doing a release, the pre-releases can be stripped with: + ```shell + dart tool/update_version.dart auto --type release + ``` +- Create a PR with this cleaned version number to denote the official release of Devtools under that number + +Verify: +* that this script updated the pubspecs under packages/ +* updated all references to those packages. +* make sure that the version constant in `packages/devtools_app/lib/devtools.dart` was updated + +These packages always have their version numbers updated in lock, so we don't have to worry about versioning. + +##### Updating to the next version +After merging a cleaned version of the current release, you can then perform a `patch`, `minor`, or `major` update. +This version can be pushed up in a separate PR to denote the start of this next version. + +> NOTE: In the future these two released commits will automatically be handled by GitHub. + - For regular monthly releases, use `minor`: ```shell dart tool/update_version.dart auto --type minor @@ -51,15 +71,6 @@ Run the `tool/update_version.dart` script to update the DevTools version. dart tool/update_version.dart auto --type release ``` -Verify: -* that this script updated the pubspecs under packages/ -* updated all references to those packages. -* make sure that the version constant in `packages/devtools_app/lib/devtools.dart` was updated - -These packages always have their version numbers updated in lock, so we don't have to worry about versioning. - -> Note: Updating to a new `dev` version will automatically prepare the version for a new `minor` release (eg, `2.17.0` will become `2.18.0-dev.0`). To update to a `major` or `patch` release instead, specify either `dev,patch` or `dev,major` (eg, `dart tool/update_version.dart auto --type dev,patch`). - #### Update the CHANGELOG.md (for non-dev releases) * Use the tool `generate-changelog` to automatically update the `packages/devtools/CHANGELOG.md` file. diff --git a/tool/release_notes/NEXT_RELEASE_NOTES.md b/tool/release_notes/NEXT_RELEASE_NOTES.md new file mode 100644 index 00000000000..005bb62105a --- /dev/null +++ b/tool/release_notes/NEXT_RELEASE_NOTES.md @@ -0,0 +1,37 @@ +This is draft for future release notes, that are going to land on +[the Flutter website](https://docs.flutter.dev/development/tools/devtools/release-notes). + +# DevTools 2.21.0 release notes + +Dart & Flutter DevTools - A Suite of Performance Tools for Dart and Flutter + +## General updates +TODO: Remove this section if there are not any general updates. + +## Inspector updates +- We are making a change + +## Performance updates +TODO: Remove this section if there are not any general updates. + +## CPU profiler updates +TODO: Remove this section if there are not any general updates. + +## Memory updates +TODO: Remove this section if there are not any general updates. + +## Debugger updates +TODO: Remove this section if there are not any general updates. + +## Network profiler updates +TODO: Remove this section if there are not any general updates. + +## Logging updates +TODO: Remove this section if there are not any general updates. + +## App size tool updates +TODO: Remove this section if there are not any general updates. + +## Changelog +More details about changes and fixes are available in the DevTools +[changelog](https://github.com/flutter/devtools/blob/master/CHANGELOG.md). diff --git a/packages/devtools_app/lib/src/framework/release_notes/release-notes-template.md b/tool/release_notes/helpers/release_notes_template.md similarity index 100% rename from packages/devtools_app/lib/src/framework/release_notes/release-notes-template.md rename to tool/release_notes/helpers/release_notes_template.md diff --git a/tool/release_notes/images/.gitkeep b/tool/release_notes/images/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tool/update_version.dart b/tool/update_version.dart index 72820b1069f..61e42229c9d 100644 --- a/tool/update_version.dart +++ b/tool/update_version.dart @@ -65,6 +65,46 @@ Future performTheVersionUpdate({ }); } +Future resetReleaseNotes({ + required String version, +}) async { + print('Resetting the release notes'); + + // Clear out the current notes + final imagesDir = Directory('./tool/release_notes/images'); + if (imagesDir.existsSync()) { + await imagesDir.delete(recursive: true); + } + + await File('./tool/release_notes/images/.gitkeep').create(); + + final currentReleaseNotesFile = + File('./tool/release_notes/NEXT_RELEASE_NOTES.md'); + if (currentReleaseNotesFile.existsSync()) { + await currentReleaseNotesFile.delete(); + } + + // Normalize the version number so that it onl + final semVerMatch = RegExp(r'^(?\d+)\.(?\d+)\.(?\d+)') + .firstMatch(version); + if (semVerMatch == null) { + throw 'Version format is unexpected'; + } + var major = int.parse(semVerMatch.namedGroup('major')!, radix: 10); + var minor = int.parse(semVerMatch.namedGroup('minor')!, radix: 10); + final normalizedVersionNumber = '$major.$minor.0'; + + final templateFile = + File('./tool/release_notes/helpers/release_notes_template.md'); + final templateFileContents = await templateFile.readAsString(); + currentReleaseNotesFile.writeAsString( + templateFileContents.replaceAll( + RegExp(r''), + normalizedVersionNumber, + ), + ); +} + String? incrementVersionByType(String version, String type) { final semVerMatch = RegExp(r'^(?\d+)\.(?\d+)\.(?\d+)') .firstMatch(version); @@ -391,5 +431,11 @@ class AutoUpdateCommand extends Command { newVersion: newVersion, modifyChangeLog: modifyChangeLog, ); + if (['minor', 'major'].contains(type)) { + // Only cycle the release notes when doing a minor or major version bump + resetReleaseNotes( + version: newVersion, + ); + } } }