diff --git a/.github/workflows/assemble_changelog.yml b/.github/workflows/assemble_changelog.yml new file mode 100644 index 00000000000..352de2221b9 --- /dev/null +++ b/.github/workflows/assemble_changelog.yml @@ -0,0 +1,31 @@ +name: Assemble changelog +on: + push: + branches: + - main + - release-v** +jobs: + process: + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-20.04 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + with: + ref: ${{github.head_ref}} + + - name: setup python + uses: actions/setup-python@v4 + with: + python-version: '3.7.7' + + - name: install python packages + run: | + python3 -m pip install requests GitPython + + - name: execute py script + run: | + python3 scripts/changelog/assemble_changelog.py diff --git a/.github/workflows/rename_changelog_file.yml b/.github/workflows/rename_changelog_file.yml new file mode 100644 index 00000000000..f32d8de9ff8 --- /dev/null +++ b/.github/workflows/rename_changelog_file.yml @@ -0,0 +1,30 @@ +name: Rename changelog files +on: + pull_request: + types: [ opened, reopened, ready_for_review, synchronize ] +jobs: + process: + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-20.04 + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + with: + ref: ${{github.head_ref}} + + - name: setup python + uses: actions/setup-python@v4 + with: + python-version: '3.7.7' + + - name: install python packages + run: | + python3 -m pip install requests GitPython + + - name: execute py script + run: | + python3 scripts/changelog/rename_changelog_file.py diff --git a/changelog/README.md b/changelog/README.md new file mode 100644 index 00000000000..1b621760894 --- /dev/null +++ b/changelog/README.md @@ -0,0 +1,84 @@ +# Multi-file running changelog + +To avoid merge conflicts in the CHANGELOG.md file we accepted the multi-file running changelog strategy. + +*This strategy works for the libnavui-androidauto project too. It works in the `libnavui-androidauto/changelog` directory* + +To follow this strategy you should create a `.md` file for every PR. Choose a directory: + +- `changelog/unreleased/features` for **Features** changes +- `changelog/unreleased/bugfixes` for **Bug fixes and improvements** changes +- `changelog/unreleased/issues` for **Known issues :warning:** changes +- `changelog/unreleased/other` for other changes + +Or you can use the helper script to do it. Just call `python3 scripts/changelog/add_changelog.py -f "I have added something special"` to create a changelog file. +Call `python3 scripts/changelog/add_changelog.py -h` to get more info. + +You can use anything that allow .md format in changelog files. + +If you have implemented several features or bugfixes you should describe all of them: + +``` +- Description of changes in md format +- Description of changes in md format also +``` + +You can choose any name for your changelog files because the GitHub action will rename files in +`changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR. + +Every push to the main or release branch Assemble changelog GitHub action will be executed: + +* collect all files from `changelog/unreleased` +* assemble the changelog like: + +``` +#### Features +- Feature 1 [#1234](https://github.com/mapbox/mapbox-navigation-android/pull/1234) +- Feature 2 [#2345](https://github.com/mapbox/mapbox-navigation-android/pull/2345) + +#### Bug fixes and improvements +- Bugfix 3 [#3456](https://github.com/mapbox/mapbox-navigation-android/pull/3456) +- Bugfix 4 [#4567](https://github.com/mapbox/mapbox-navigation-android/pull/4567) + +#### Known issues :warning: +- Issue 1 +- Issue 2 + +Some other changes +``` + +* write the changelog to the `changelog/unreleased/CHANGELOG.md` file + +Every release the release train app will: + +* get changelog from `changelog/unreleased/CHANGELOG.md` file +* add information about dependencies and compile changelog like: +``` +## Mapbox Navigation SDK 1.1.1 - 13 December, 2022 +### Changelog +[Changes between v1.1.0 and v1.1.1](https://github.com/mapbox/mapbox-navigation-android/compare/v1.1.0...v1.1.1) + +#### Features +- Feature 1 [#1234](https://github.com/mapbox/mapbox-navigation-android/pull/1234) +- Feature 2 [#2345](https://github.com/mapbox/mapbox-navigation-android/pull/2345) + +#### Bug fixes and improvements +- Bugfix 3 [#3456](https://github.com/mapbox/mapbox-navigation-android/pull/3456) +- Bugfix 4 [#4567](https://github.com/mapbox/mapbox-navigation-android/pull/4567) + +#### Known issues :warning: +- Issue 1 +- Issue 2 + +Some other changes + +### Mapbox dependencies +This release depends on, and has been tested with, the following Mapbox dependencies: +- Mapbox Maps SDK `v10.8.0` ([release notes](https://github.com/mapbox/mapbox-maps-android/releases/tag/v10.8.0)) +- Mapbox Navigation Native `v115.0.1` +- Mapbox Core Common `v23.0.0` +- Mapbox Java `v6.8.0` ([release notes](https://github.com/mapbox/mapbox-java/releases/tag/v6.8.0)) +- Mapbox Android Core `v5.0.2` ([release notes](https://github.com/mapbox/mapbox-events-android/releases/tag/core-5.0.2)) +``` +* add compiled changelog to `CHANGELOG.md` file +* delete all files in `changelog/unreleased` dir diff --git a/changelog/unreleased/CHANGELOG.md b/changelog/unreleased/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/changelog/unreleased/bugfixes/6466.md b/changelog/unreleased/bugfixes/6466.md new file mode 100644 index 00000000000..2c3139467aa --- /dev/null +++ b/changelog/unreleased/bugfixes/6466.md @@ -0,0 +1 @@ +- Each newly instantiated MapboxRouteArrowView class will initialize the layers with the provided options on the first render call. Previously this would only be done if the layers hadn't already been initialized. \ No newline at end of file diff --git a/changelog/unreleased/bugfixes/6678.md b/changelog/unreleased/bugfixes/6678.md new file mode 100644 index 00000000000..8b04c8ff4ec --- /dev/null +++ b/changelog/unreleased/bugfixes/6678.md @@ -0,0 +1,18 @@ +- :warning: Updated the `NavigationView` default navigation puck asset. + + Previous puck can be restored by injecting `LocationPuck2D` with the `bearingImage` set to `com.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icon` drawable: + ```kotlin + navigationView.customizeViewStyles { + locationPuckOptions = LocationPuckOptions.Builder(context) + .defaultPuck( + LocationPuck2D( + bearingImage = ContextCompat.getDrawable( + context, + com.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icon, + ) + ) + ) + .idlePuck(regularPuck(context)) + .build() + } + ``` \ No newline at end of file diff --git a/changelog/unreleased/bugfixes/6760.md b/changelog/unreleased/bugfixes/6760.md new file mode 100644 index 00000000000..13a3bdac0cf --- /dev/null +++ b/changelog/unreleased/bugfixes/6760.md @@ -0,0 +1 @@ +- Fixed a rare `java.lang.NullPointerException: Attempt to read from field 'SpeechAnnouncement PlayCallback.announcement' on a null object reference` crash in `PlayCallback.getAnnouncement`. \ No newline at end of file diff --git a/changelog/unreleased/bugfixes/6764.md b/changelog/unreleased/bugfixes/6764.md new file mode 100644 index 00000000000..9bb3e126854 --- /dev/null +++ b/changelog/unreleased/bugfixes/6764.md @@ -0,0 +1 @@ +- Added guarantees that route progress with `RouteProgress#currentState == OFF_ROUTE` arrives earlier than `NavigationRerouteController#reroute` is called. \ No newline at end of file diff --git a/changelog/unreleased/bugfixes/6766.md b/changelog/unreleased/bugfixes/6766.md new file mode 100644 index 00000000000..9b61219f81a --- /dev/null +++ b/changelog/unreleased/bugfixes/6766.md @@ -0,0 +1 @@ +- Fixed an issue where the first voice instruction might have been played twice. \ No newline at end of file diff --git a/changelog/unreleased/bugfixes/6770.md b/changelog/unreleased/bugfixes/6770.md new file mode 100644 index 00000000000..62cde79b89e --- /dev/null +++ b/changelog/unreleased/bugfixes/6770.md @@ -0,0 +1 @@ +- Introduced `NavigationViewListener.onSpeedInfoClicked` that would be triggered when `MapboxSpeedInfoView` is clicked upon. \ No newline at end of file diff --git a/changelog/unreleased/bugfixes/6774.md b/changelog/unreleased/bugfixes/6774.md new file mode 100644 index 00000000000..7ad38b72454 --- /dev/null +++ b/changelog/unreleased/bugfixes/6774.md @@ -0,0 +1 @@ +- Fixed standalone `MapboxManeuverView` appearance when the app also integrates Drop-In UI. \ No newline at end of file diff --git a/libnavui-androidauto/changelog/unreleased/CHANGELOG.md b/libnavui-androidauto/changelog/unreleased/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/scripts/changelog/add_changelog.py b/scripts/changelog/add_changelog.py new file mode 100644 index 00000000000..3e7b5539077 --- /dev/null +++ b/scripts/changelog/add_changelog.py @@ -0,0 +1,33 @@ +import argparse +import os + +parser = argparse.ArgumentParser(description='Add a new changelog file') + +parser.add_argument('-f', '--feature', nargs='+', help='Features') +parser.add_argument('-b', '--bugfix', nargs='+', help='Bug fixes and improvements') +parser.add_argument('-i', '--issue', nargs='+', help='Known issues :warning:') +parser.add_argument('-o', '--other', nargs='+', help='Other changes') + +args = parser.parse_args() + + +def write_file(changes, dir): + filename = 'changelog/unreleased/' + dir + '/changes.md' + os.makedirs(os.path.dirname(filename), exist_ok=True) + prepared_changes = '' + for change in changes: + prepared_changes += '- ' + change + '\n' + open(filename, 'w').write(prepared_changes) + + +if args.feature: + write_file(args.feature, 'features') + +if args.bugfix: + write_file(args.bugfix, 'bugfixes') + +if args.issue: + write_file(args.issue, 'issues') + +if args.other: + write_file(args.other, 'other') diff --git a/scripts/changelog/assemble_changelog.py b/scripts/changelog/assemble_changelog.py new file mode 100644 index 00000000000..587c1014050 --- /dev/null +++ b/scripts/changelog/assemble_changelog.py @@ -0,0 +1,60 @@ +import os + +import git + + +def get_changes(path): + changes = '' + if not os.path.isdir(path): + return '' + files = os.listdir(path) + for file in files: + pr_number = file.partition('.')[0] + pr_changes = open(path + file, 'r').read() + if path.endswith('bugfixes/') or path.endswith('features/'): + pr_link = ' [#' + pr_number + '](https://github.com/mapbox/mapbox-navigation-android/pull/' + pr_number + ')' + '\n' + lines_with_description = [] + for line in open(path + file, 'r').readlines(): + if line.startswith('- '): + lines_with_description.append(line) + for line in lines_with_description: + pr_changes = pr_changes.replace(line, line.replace('\n', '') + pr_link) + if not pr_changes.endswith('\n'): + pr_changes += '\n' + changes += pr_changes + return changes.strip() + + +bugfixes = get_changes('changelog/unreleased/bugfixes/') +features = get_changes('changelog/unreleased/features/') +issues = get_changes('changelog/unreleased/issues/') +other = get_changes('changelog/unreleased/other/') + +changelog = '#### Features\n' + features + '\n\n' + \ + '#### Bug fixes and improvements\n' + bugfixes + '\n\n' + \ + '#### Known issues :warning:\n' + issues + '\n\n' + \ + '#### Other changes\n' + other + +old_changelog = open('changelog/unreleased/CHANGELOG.md', 'r').read() + +if changelog != old_changelog: + open('changelog/unreleased/CHANGELOG.md', 'w').write(changelog) + repository = git.Repo('.') + repository.git.add('changelog/unreleased') + repository.index.commit('Assemble changelog file [skip ci]') + repository.remotes.origin.push().raise_if_error() + +auto_bugfixes = get_changes('libnavui-androidauto/changelog/unreleased/bugfixes/') +auto_features = get_changes('libnavui-androidauto/changelog/unreleased/features/') + +auto_changelog = '#### Features\n' + auto_features + '\n\n' + \ + '#### Bug fixes and improvements\n' + auto_bugfixes + +auto_old_changelog = open('libnavui-androidauto/changelog/unreleased/CHANGELOG.md', 'r').read() + +if auto_changelog != auto_old_changelog: + open('libnavui-androidauto/changelog/unreleased/CHANGELOG.md', 'w').write(auto_changelog) + repository = git.Repo('.') + repository.git.add('libnavui-androidauto/changelog/unreleased') + repository.index.commit('Assemble auto changelog file [skip ci]') + repository.remotes.origin.push().raise_if_error() diff --git a/scripts/changelog/rename_changelog_file.py b/scripts/changelog/rename_changelog_file.py new file mode 100644 index 00000000000..57108f82af4 --- /dev/null +++ b/scripts/changelog/rename_changelog_file.py @@ -0,0 +1,43 @@ +import os +import re + +import git + +pr_number = os.environ['PR_NUMBER'] +token = os.environ['GITHUB_TOKEN'] + +pattern = re.compile("^\d*.md") + + +def rename_files(path): + if not os.path.isdir(path): + return 0 + + renamed_files_count = 0 + files = os.listdir(path) + + new_md_files = list(filter(lambda file: not pattern.match(file), files)) + + if len(new_md_files) > 1: + raise Exception('More than one new changelog file') + + for file in new_md_files: + if not pattern.match(file): + os.rename(path + file, path + pr_number + '.md') + renamed_files_count += 1 + + return renamed_files_count + + +renamed_bugfixes_count = rename_files('changelog/unreleased/bugfixes/') +renamed_features_count = rename_files('changelog/unreleased/features/') + +auto_renamed_bugfixes_count = rename_files('libnavui-androidauto/changelog/unreleased/bugfixes/') +auto_renamed_features_count = rename_files('libnavui-androidauto/changelog/unreleased/features/') + +if renamed_features_count + renamed_bugfixes_count + auto_renamed_bugfixes_count + auto_renamed_features_count > 0: + repository = git.Repo('.') + repository.git.add('changelog/unreleased') + repository.git.add('libnavui-androidauto/changelog/unreleased') + repository.index.commit('Rename changelog files') + repository.remotes.origin.push().raise_if_error() diff --git a/scripts/validate-changelog-tests.py b/scripts/validate-changelog-tests.py index 92c43f8b4fe..ebeb4276f29 100644 --- a/scripts/validate-changelog-tests.py +++ b/scripts/validate-changelog-tests.py @@ -1,6 +1,8 @@ +import os import unittest + import validate_changelog_utils -import os + class TestValidateChangelog(unittest.TestCase): @@ -9,20 +11,15 @@ def test_should_skip_changelog_no_labels(self): self.assertEqual(validate_changelog_utils.should_skip_changelog(json), False) def test_should_skip_changelog_no_skip_changelog_label(self): - json = { "labels": [{ "name": "some label" }] } + json = {"labels": [{"name": "some label"}]} self.assertEqual(validate_changelog_utils.should_skip_changelog(json), False) def test_should_skip_changelog_has_skip_changelog_label(self): - json = { "labels": [{"name": "some label"}, {"name": "skip changelog"}] } + json = {"labels": [{"name": "some label"}, {"name": "skip changelog"}]} self.assertEqual(validate_changelog_utils.should_skip_changelog(json), True) def test_check_has_changelog_diff_no_diff(self): diff = ''' - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision 25782d7748a343b2e4c85954cfa5c22846343f28) +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659101434632) @@ -39,27 +36,15 @@ def test_check_has_changelog_diff_no_diff(self): def test_check_has_changelog_diff_has_diff(self): diff = ''' - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision d85b11703af7976027073a5e29ec51ffc2164b6e) - +++ b/CHANGELOG.md (date 1659101554037) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== + diff --git a/changelog/unreleased/features/amazing-feature.md b/changelog/unreleased/features/amazing-feature.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/features/amazing-feature.md + @@ -0,0 +1 @@ + +- Definitely amazing feature + +- Nice changes + \ No newline at end of file diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision 25782d7748a343b2e4c85954cfa5c22846343f28) +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659101434632) @@ -73,595 +58,116 @@ def test_check_has_changelog_diff_has_diff(self): ''' validate_changelog_utils.check_has_changelog_diff(diff) + def test_check_has_changelog_diff_has_diff_bugfixes(self): + diff = ''' + diff --git a/changelog/unreleased/bugfixes/amazing-fix.md b/changelog/unreleased/bugfixes/amazing-fix.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/features/amazing-fix.md + @@ -0,0 +1 @@ + +- Definitely amazing fix + +- Nice changes + \ No newline at end of file + ''' + validate_changelog_utils.check_has_changelog_diff(diff) + + def test_check_has_changelog_diff_has_diff_issues(self): + diff = ''' + diff --git a/changelog/unreleased/issues/amazing-issue.md b/changelog/unreleased/issues/amazing-issue.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/issues/amazing-issue.md + @@ -0,0 +1 @@ + +- Definitely amazing issue + +- Nice changes + \ No newline at end of file + ''' + validate_changelog_utils.check_has_changelog_diff(diff) + + def test_check_has_changelog_diff_has_diff_other(self): + diff = ''' + diff --git a/changelog/unreleased/other/amazing-other.md b/changelog/unreleased/other/amazing-other.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/other/amazing-other.md + @@ -0,0 +1 @@ + +- Definitely amazing other + +- Nice changes + \ No newline at end of file + ''' + validate_changelog_utils.check_has_changelog_diff(diff) + def test_parse_contents_url_empty_json(self): with self.assertRaises(Exception): validate_changelog_utils.parse_contents_url([]) def test_parse_contents_url_no_changelog(self): with self.assertRaises(Exception): - validate_changelog_utils.parse_contents_url([{ "filename": "not_changelog.md" }]) + validate_changelog_utils.parse_contents_url([{"filename": "not_changelog.md"}]) def test_parse_contents_url_has_changelog_no_url(self): with self.assertRaises(Exception): - validate_changelog_utils.parse_contents_url([{ "filename": "CHANGELOG.md" }]) + validate_changelog_utils.parse_contents_url([{"filename": "CHANGELOG.md"}]) def test_parse_contents_url_has_changelog_and_url(self): filename = "CHANGELOG.md" url = "my url" - actual = validate_changelog_utils.parse_contents_url([{ "filename": filename, "contents_url": url }]) - self.assertEqual(actual, { filename : url }) + actual = validate_changelog_utils.parse_contents_url([{"filename": filename, "contents_url": url}]) + self.assertEqual(actual, {filename: url}) def test_extract_added_lines_only_changelog_nothing_added(self): - diff = '''diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision 145c2d43cb3404f28975538ad440504d5ed74562) - +++ b/CHANGELOG.md (date 1659101646796) - @@ -5,7 +5,6 @@ - ## Unreleased - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - -- Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) + diff = ''' + diff --git a/changelog/unreleased/issues/example-known-issues.md b/changelog/unreleased/issues/example-known-issues.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/issues/example-known-issues.md + @@ -0,0 +1 @@ + - It is an example of known issues + -- + \ No newline at end of file ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), { "CHANGELOG.md" : [] }) + self.assertEqual(validate_changelog_utils.extract_added_lines(diff), + {"changelog/unreleased/issues/example-known-issues.md": []}) def test_extract_added_lines_only_changelog_has_added(self): expected = { - "CHANGELOG.md" : ['- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'] + "changelog/unreleased/issues/example-known-issues.md": ['- It is an example of known issues'] } - diff = '''diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision fca6af9072a1b6cb7263460f7c3270e48bffed07) - +++ b/CHANGELOG.md (date 1659101777554) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) + diff = ''' + diff --git a/changelog/unreleased/issues/example-known-issues.md b/changelog/unreleased/issues/example-known-issues.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/issues/example-known-issues.md + @@ -0,0 +1 @@ + +- It is an example of known issues + \ No newline at end of file ''' self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) def test_extract_added_lines_only_changelog_has_added_with_blank_lines(self): expected = { - "CHANGELOG.md" : ['- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'] + "changelog/unreleased/issues/example-known-issues.md": ['- It is an example of known issues'] } - diff = '''diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision fca6af9072a1b6cb7263460f7c3270e48bffed07) - +++ b/CHANGELOG.md (date 1659101777554) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) + diff = ''' + diff --git a/changelog/unreleased/issues/example-known-issues.md b/changelog/unreleased/issues/example-known-issues.md + new file mode 100644 + index 00000000000..c0505027151 + --- /dev/null + +++ b/changelog/unreleased/issues/example-known-issues.md + @@ -0,0 +1 @@ + +- It is an example of known issues + + - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_only_changelog_with_path_has_added(self): - expected = { - "libnavui-androidauto/CHANGELOG.md" : ['- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'] - } - diff = '''diff --git a/libnavui-androidauto/CHANGELOG.md b/libnavui-androidauto/CHANGELOG.md - --- a/libnavui-androidauto/CHANGELOG.md (revision ee5039502306c1ea6449f57615a2ad0f7f23fd83) - +++ b/libnavui-androidauto/CHANGELOG.md (date 1661336275515) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Added. [#6165](https://github.com/mapbox/mapbox-navigation-android/pull/6165) - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_several_changelogs_in_a_row_has_added(self): - expected = { - "libnavui-androidauto/CHANGELOG.md" : ['- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'], - "CHANGELOG.md" : ['- Added fourth unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'] - } - diff = '''diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision e53b37ad3a4540bdb0878b4679a174f9518134b0) - +++ b/CHANGELOG.md (date 1661336645379) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added fourth unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Added2. [#6145](https://github.com/mapbox/mapbox-navigation-android/pull/6145) - Index: libnavui-androidauto/CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavui-androidauto/CHANGELOG.md b/libnavui-androidauto/CHANGELOG.md - --- a/libnavui-androidauto/CHANGELOG.md (revision 9307f85eaea82470de6f3111ff0218f76e1d9779) - +++ b/libnavui-androidauto/CHANGELOG.md (date 1661336328085) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Added. [#6165](https://github.com/mapbox/mapbox-navigation-android/pull/6165) - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_several_changelogs_divided_has_added(self): - expected = { - "libnavui-androidauto/CHANGELOG.md" : ['- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'], - "CHANGELOG.md" : ['- Added fourth unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'] - } - diff = '''diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision e53b37ad3a4540bdb0878b4679a174f9518134b0) - +++ b/CHANGELOG.md (date 1661336645379) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added fourth unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Added2. [#6145](https://github.com/mapbox/mapbox-navigation-android/pull/6145) - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision 85db37c032b85d89c65f909c65dbf4e36130bc95) - +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659101643213) - @@ -4,5 +4,5 @@ - - fun testMethod1() {} - - - fun testMethod2(a: Int) = a * 10 - + fun testMethod2(a: Int, b: Int) = a * 10 + b - } - Index: libnavui-androidauto/CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavui-androidauto/CHANGELOG.md b/libnavui-androidauto/CHANGELOG.md - --- a/libnavui-androidauto/CHANGELOG.md (revision 9307f85eaea82470de6f3111ff0218f76e1d9779) - +++ b/libnavui-androidauto/CHANGELOG.md (date 1661336328085) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Added. [#6165](https://github.com/mapbox/mapbox-navigation-android/pull/6165) - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_several_changelogs_only_one_has_added(self): - expected = { - "CHANGELOG.md" : [], - "libnavui-androidauto/CHANGELOG.md" : ['- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)'] - } - diff = ''' - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision 2fed9e01ca0f2e15ce15f104a2175b12f48f15d4) - +++ b/CHANGELOG.md (date 1661341839927) - @@ -5,7 +5,6 @@ - ## Unreleased - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - -- Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - - #### Bug fixes and improvements - - Added2. [#6145](https://github.com/mapbox/mapbox-navigation-android/pull/6145) - Index: libnavui-androidauto/CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavui-androidauto/CHANGELOG.md b/libnavui-androidauto/CHANGELOG.md - --- a/libnavui-androidauto/CHANGELOG.md (revision 4710fa5f28a132f6db42d1d580650a4b14987368) - +++ b/libnavui-androidauto/CHANGELOG.md (date 1661336328085) - @@ -6,6 +6,7 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Added. [#6165](https://github.com/mapbox/mapbox-navigation-android/pull/6165) - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_changelog_in_the_beginning_nothing_added(self): - diff = ''' - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision 85db37c032b85d89c65f909c65dbf4e36130bc95) - +++ b/CHANGELOG.md (date 1659101873752) - @@ -5,7 +5,6 @@ - ## Unreleased - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - -- Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision 85db37c032b85d89c65f909c65dbf4e36130bc95) - +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659101643213) - @@ -4,5 +4,5 @@ - - fun testMethod1() {} - - - fun testMethod2(a: Int) = a * 10 - + fun testMethod2(a: Int, b: Int) = a * 10 + b - } - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), { "CHANGELOG.md" : [] }) - - def test_extract_added_lines_changelog_in_the_beginning_has_added(self): - expected = { - "CHANGELOG.md" : [ - '- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050)', - '- Fixed third unreleased bug. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045)' - ] - } - diff = ''' - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision 3231aea607a4bc1edc8ee28cf695dfdb06399a30) - +++ b/CHANGELOG.md (date 1659104161551) - @@ -6,10 +6,12 @@ - #### Features - - Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049) - - Added second unreleased feature. [#6048](https://github.com/mapbox/mapbox-navigation-android/pull/6048) - +- Added third unreleased feature. [#6050](https://github.com/mapbox/mapbox-navigation-android/pull/6050) - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - - Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046) - +- Fixed third unreleased bug. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045) - - ## Mapbox Navigation SDK 2.7.0-beta.1 - 14 July, 2022 - ### Changelog - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision b96eff8c2c354263379ca588a17bbf4df6c802b8) - +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659104022448) - @@ -4,5 +4,5 @@ - - fun testMethod1() {} - - - fun testMethod2(a: Int) = a * 10 - + fun testMethod2(a: Int, b: Int) = a * 10 + b - } - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_changelog_in_the_end_nothing_added(self): - diff = ''' - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/.circleci/config2.yml b/.circleci/config2.yml - --- a/.circleci/config2.yml (revision 2f1ddf175da5069b30d519119c52441f74a46974) - +++ b/.circleci/config2.yml (date 1659105154622) - @@ -1,0 +1,1 @@ - +Added line - Index: .circleci/config2.yml - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision 2f1ddf175da5069b30d519119c52441f74a46974) - +++ b/CHANGELOG.md (date 1659105181666) - @@ -9,7 +9,6 @@ - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - -- Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046) - - ## Mapbox Navigation SDK 2.7.0-beta.1 - 14 July, 2022 - ### Changelog - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), { "CHANGELOG.md" : [] }) - - def test_extract_added_lines_changelog_in_the_end_has_added(self): - expected = { - "CHANGELOG.md" : ['- Fixed third unreleased bug. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045)'] - } - diff = ''' - Index: .circleci/config2.yml - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/.circleci/config2.yml b/.circleci/config2.yml - --- a/.circleci/config2.yml (revision 03d0067b1a8fabbe70ccc9c8017c6c64a4d57cbb) - +++ b/.circleci/config2.yml (date 1659105387306) - @@ -1,0 +1,1 @@ - +Added line - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision ab3d6d6132f62cca268f5e664aecfc306d5c3fd5) - +++ b/CHANGELOG.md (date 1659105404056) - @@ -9,6 +9,7 @@ - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - +- Fixed third unreleased bug. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045) - - Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046) - - ## Mapbox Navigation SDK 2.7.0-beta.1 - 14 July, 2022 - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - - def test_extract_added_lines_changelog_in_the_middle_nothing_added(self): - diff = ''' - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision 0cf46e4ad84d2d914d1be07ac94401d1eb684ab5) - +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659105514618) - @@ -4,5 +4,5 @@ - - fun testMethod1() {} - - - fun testMethod2(a: Int) = a * 10 - + fun testMethod2(a: Int, b: Int) = a * 10 + b * 5 - } - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision 2db5f9ac7a0be448ae6acc9108b722a75a8f1c7a) - +++ b/CHANGELOG.md (date 1659105622366) - @@ -9,7 +9,6 @@ - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - -- Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046) - - ## Mapbox Navigation SDK 2.7.0-beta.1 - 14 July, 2022 - ### Changelog - Index: .circleci/config2.yml - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/.circleci/config2.yml b/.circleci/config2.yml - --- a/.circleci/config2.yml (revision 0cf46e4ad84d2d914d1be07ac94401d1eb684ab5) - +++ b/.circleci/config2.yml (date 1659105387306) - @@ -1,0 +1,1 @@ - +Added line - ''' - self.assertEqual(validate_changelog_utils.extract_added_lines(diff), { "CHANGELOG.md" : [] }) - - def test_extract_added_lines_changelog_in_the_middle_has_added(self): - expected = { - "CHANGELOG.md" : ['- Fixed third unreleased bug. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045)'] - } - diff = ''' - Index: libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt - --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (revision 0cf46e4ad84d2d914d1be07ac94401d1eb684ab5) - +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/TestClass.kt (date 1659105514618) - @@ -4,5 +4,5 @@ - - fun testMethod1() {} - - - fun testMethod2(a: Int) = a * 10 - + fun testMethod2(a: Int, b: Int) = a * 10 + b * 5 - } - Index: CHANGELOG.md - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/CHANGELOG.md b/CHANGELOG.md - --- a/CHANGELOG.md (revision ab3d6d6132f62cca268f5e664aecfc306d5c3fd5) - +++ b/CHANGELOG.md (date 1659105418509) - @@ -9,6 +9,7 @@ - - #### Bug fixes and improvements - - Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047) - +- Fixed third unreleased bug. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045) - - Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046) - - ## Mapbox Navigation SDK 2.7.0-beta.1 - 14 July, 2022 - Index: .circleci/config2.yml - IDEA additional info: - Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP - <+>UTF-8 - =================================================================== - diff --git a/.circleci/config2.yml b/.circleci/config2.yml - --- a/.circleci/config2.yml (revision ab3d6d6132f62cca268f5e664aecfc306d5c3fd5) - +++ b/.circleci/config2.yml (date 1659105387306) - @@ -1,0 +1,1 @@ - +Added line + + + \ No newline at end of file ''' self.assertEqual(validate_changelog_utils.extract_added_lines(diff), expected) - def test_check_contains_pr_link_empty(self): - added_lines = {} - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_none_contain(self): - added_lines = { - "CHANGELOG.md" : ['- Added 1.', '- Added 2.'] - } - with self.assertRaises(Exception): - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_only_one_contains(self): - added_lines = { - "CHANGELOG.md" : [ - '- Added 1. [#6053](https://github.com/mapbox/mapbox-navigation-android/pull/6053)', - '- Added 2.' - ] - } - with self.assertRaises(Exception): - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_all_contain(self): - added_lines = { - "CHANGELOG.md" : [ - '- Added 1. [#6053](https://github.com/mapbox/mapbox-navigation-android/pull/6053)', - '- Added 2. [#6012](https://github.com/mapbox/mapbox-navigation-android/pull/6012)' - ] - } - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_not_all_files_contain(self): - added_lines = { - "CHANGELOG.md" : [ - '- Added 1. [#6053](https://github.com/mapbox/mapbox-navigation-android/pull/6053)', - '- Added 2. [#6012](https://github.com/mapbox/mapbox-navigation-android/pull/6012)' - ], - "path/CHANGELOG.md" : [ - '- Added 3.' - ] - } - with self.assertRaises(Exception): - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_multiple_files(self): - added_lines = { - "CHANGELOG.md" : [ - '- Added 1. [#6053](https://github.com/mapbox/mapbox-navigation-android/pull/6053)', - '- Added 2. [#6012](https://github.com/mapbox/mapbox-navigation-android/pull/6012)' - ], - "path/CHANGELOG.md" : [ - '- Added 3. [#6052](https://github.com/mapbox/mapbox-navigation-android/pull/6052)' - ] - } - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_all_contain_except_empty_line(self): - added_lines = { - "CHANGELOG.md" : [ - '- Added 1. [#6053](https://github.com/mapbox/mapbox-navigation-android/pull/6053)', - '- Added 2. [#6012](https://github.com/mapbox/mapbox-navigation-android/pull/6012)', - '' - ] - } - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_contains_pr_link_all_contain_except_blank_line(self): - added_lines = { - "CHANGELOG.md" : [ - '- Added 1. [#6053](https://github.com/mapbox/mapbox-navigation-android/pull/6053)', - '- Added 2. [#6012](https://github.com/mapbox/mapbox-navigation-android/pull/6012)', - ' ' - ] - } - validate_changelog_utils.check_contains_pr_link(added_lines) - - def test_check_version_section_empty_lines(self): - content = self.read_test_changelog("test_changelog.md") - added_lines = [] - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_single_line_not_unreleased(self): - content = self.read_test_changelog("test_changelog.md") - added_lines = ['- Added first feature to 2.7.0-beta1. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045)'] - with self.assertRaises(Exception): - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_multiple_lines_one_not_unreleased(self): - content = self.read_test_changelog("test_changelog.md") - added_lines = [ - '- Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047)', - '- Added first feature to 2.7.0-beta1. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045)', - ] - with self.assertRaises(Exception): - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_multiple_lines_all_unreleased(self): - content = self.read_test_changelog("test_changelog.md") - added_lines = [ - '- Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047)', - '- Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046)', - ] - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_single_line_repeats_stable_version(self): - content = self.read_test_changelog("test_changelog_single_line_repeats_stable_version.md") - added_lines = ['- Added second feature to 2.6.0. [#6013](https://github.com/mapbox/mapbox-navigation-android/pull/6013)'] - with self.assertRaises(Exception): - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_multiple_lines_one_repeats_stable_version(self): - content = self.read_test_changelog("test_changelog_single_line_repeats_stable_version.md") - added_lines = [ - '- Fixed first unreleased bug. [#6047](https://github.com/mapbox/mapbox-navigation-android/pull/6047)', - '- Added second feature to 2.6.0. [#6013](https://github.com/mapbox/mapbox-navigation-android/pull/6013)' - ] - with self.assertRaises(Exception): - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_multiple_lines_all_unique(self): - content = self.read_test_changelog("test_changelog.md") - added_lines = [ - '- Added first unreleased feature. [#6049](https://github.com/mapbox/mapbox-navigation-android/pull/6049)', - '- Fixed second unreleased bug. [#6046](https://github.com/mapbox/mapbox-navigation-android/pull/6046)' - ] - validate_changelog_utils.check_version_section(content, added_lines) - - def test_check_version_section_single_line_repeats_unstable_version(self): - content = self.read_test_changelog("test_changelog_single_line_repeats_unstable_version.md") - added_lines = ['- Added first feature to 2.7.0-beta1. [#6045](https://github.com/mapbox/mapbox-navigation-android/pull/6045)'] - validate_changelog_utils.check_version_section(content, added_lines) - def test_check_for_duplications_empty_list(self): validate_changelog_utils.check_for_duplications([]) @@ -691,5 +197,6 @@ def read_test_changelog(self, filename): data = f.read() return data + if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() diff --git a/scripts/validate-changelog.py b/scripts/validate-changelog.py index 53ab0432673..bd0fb34324b 100644 --- a/scripts/validate-changelog.py +++ b/scripts/validate-changelog.py @@ -1,8 +1,9 @@ #!/usr/bin/python -import requests import sys -import base64 + +import requests + import validate_changelog_utils print("Validating that changelog entry is provided in the CHANGELOG.md...") @@ -25,14 +26,8 @@ diff = diff_response.text validate_changelog_utils.check_has_changelog_diff(diff) added_lines_by_file = validate_changelog_utils.extract_added_lines(diff) - validate_changelog_utils.check_contains_pr_link(added_lines_by_file) - with requests.get(files_url, headers) as files_response: - contents_urls_by_file = validate_changelog_utils.parse_contents_url(files_response.json()) - for (filename, contents_url) in contents_urls_by_file.items(): - validate_changelog_utils.check_for_duplications(added_lines_by_file[filename]) - with requests.get(contents_url, headers) as contents_response: - content = base64.b64decode(contents_response.json()["content"]).decode("utf-8") - validate_changelog_utils.check_version_section(content, added_lines_by_file[filename]) + for lines in added_lines_by_file.values(): + validate_changelog_utils.check_for_duplications(added_lines_by_file) print("Changelog entry validation successful.") else: print("`skip changelog` label present, exiting.") diff --git a/scripts/validate_changelog_utils.py b/scripts/validate_changelog_utils.py index 91836f620d3..b1025e54157 100644 --- a/scripts/validate_changelog_utils.py +++ b/scripts/validate_changelog_utils.py @@ -1,21 +1,25 @@ import re -changelog_diff_regex = "^([\s]*)diff --git a(.*)\/CHANGELOG.md b(.*)\/CHANGELOG.md" +changelog_diff_regex = "^([\s]*)diff --git a/changelog/unreleased/(features|bugfixes|issues|other)/(.*).md b/changelog/unreleased/(features|bugfixes|issues|other)/(.*).md" changelog_diff_filename_regex = re.compile("([\s]*)diff --git a\/(.*) b\/(.*)") changelog_filename = "CHANGELOG.md" any_diff_substring = "diff --git" diff_file_start_regex = "^([\s]*)\@\@(.*)\@\@" pr_link_regex = "\[#\d+]\(https:\/\/github\.com\/mapbox\/mapbox-navigation-android\/pull\/\d+\)" + def is_line_added(line): return line.strip().startswith('+') + def is_line_not_blank(line): return len(line.strip()) > 0 + def remove_plus(line): return line.strip()[1:] + def group_by_versions(lines): groups = {} group = [] @@ -33,12 +37,14 @@ def group_by_versions(lines): groups[group_name] = group return groups + def extract_unreleased_group(versions): for version in versions.keys(): if 'Unreleased' in version: return versions[version] raise Exception("No 'Unreleased' section in CHANGELOG") + def extract_stable_versions(versions): str_before_version = "Mapbox Navigation SDK " str_after_version = " " @@ -57,6 +63,7 @@ def extract_stable_versions(versions): stable_versions[version_name] = versions[version] return stable_versions + def should_skip_changelog(response_json): if "labels" in response_json: pr_labels = response_json["labels"] @@ -65,10 +72,13 @@ def should_skip_changelog(response_json): return True return False + def check_has_changelog_diff(diff): changelog_diff_matches = re.search(changelog_diff_regex, diff, re.MULTILINE) if not changelog_diff_matches: - raise Exception("Add a non-empty changelog entry in a CHANGELOG.md or add a `skip changelog` label if not applicable.") + raise Exception( + "Add a non-empty changelog file in changelog/unreleased/${type of changes} or add a `skip changelog` label if not applicable.") + def parse_contents_url(files_response_json): content_urls = {} @@ -80,6 +90,7 @@ def parse_contents_url(files_response_json): raise Exception("No CHANGELOG.md file in PR files") return content_urls + def extract_added_lines(whole_diff): added_lines = {} diff = whole_diff @@ -101,36 +112,16 @@ def extract_added_lines(whole_diff): diff_searchable = diff_starting_at_changelog[first_changelog_diff_index:last_reachable_index] diff_lines = diff_searchable.split('\n') - added_lines[filename] = list(filter(is_line_not_blank, map(remove_plus, list(filter(is_line_added, diff_lines))))) + added_lines[filename] = list( + filter(is_line_not_blank, map(remove_plus, list(filter(is_line_added, diff_lines))))) diff = diff[last_reachable_index:] return added_lines -def check_contains_pr_link(added_lines_by_file): - for filename in added_lines_by_file: - for added_line in added_lines_by_file[filename]: - if len(added_line.strip()) > 0: - pr_link_matches = re.search(pr_link_regex, added_line) - if not pr_link_matches: - raise Exception("The changelog entry \"" + added_line + "\" in \"" + filename + "\" should contain a link to the original PR that matches `" + pr_link_regex + "`") - -def check_version_section(content, added_lines): - lines = content.split("\n") - versions = group_by_versions(lines) - unreleased_group = extract_unreleased_group(versions) - stable_versions = extract_stable_versions(versions) - - for added_line in added_lines: - if added_line not in unreleased_group: - raise Exception("\"" + added_line + "\" should be placed in 'Unreleased' section") - - for stable_version in stable_versions: - if added_line in stable_versions[stable_version]: - raise Exception("The changelog entry \"" + added_line + "\" is already contained in " + stable_version + " changelog.") def check_for_duplications(added_lines): unique_added_lines = set() for added_line in added_lines: if added_line in unique_added_lines: - raise Exception("\"" + added_line + "\" is added more than once" ) + raise Exception("\"" + added_line + "\" is added more than once") else: unique_added_lines.add(added_line)