Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2831885
Multi-file running changelog strategy
Dec 13, 2022
e5f6e04
Reformat validate changelog utils file
Dec 13, 2022
e2fbbe8
Use md changelog files and get type from path
Dec 15, 2022
94b2ccf
Rename changelog files action
Dec 19, 2022
780f542
fix action type
Dec 19, 2022
3813aba
rename action
Dec 19, 2022
20386e7
fix script name
Dec 19, 2022
8c28e15
assemble changelog after merge to main and release branches
Dec 19, 2022
2e9ace8
assemble changelog after merge to main and release branches
Dec 20, 2022
1f64183
change remote url
Dec 20, 2022
6daece7
change user
Dec 20, 2022
4699a72
push from actions
Dec 20, 2022
8388caa
change remote url from script
Dec 20, 2022
73cbfbd
debug changing config
Dec 20, 2022
78a521d
fix
Dec 20, 2022
8c58767
fix
Dec 20, 2022
69756b2
debug
Dec 20, 2022
87ecfe2
fix
Dec 20, 2022
e7286d6
Rename changelog files
Dec 20, 2022
87cbc1b
test assemble changelog
Dec 20, 2022
c83968d
test assemble changelog
Dec 20, 2022
79941ad
test assemble changelog
Dec 20, 2022
a12a9c8
test assemble changelog
Dec 20, 2022
a8f69b4
fix
Dec 20, 2022
cc27e5a
Assemble changelog file [skip actions]
Dec 20, 2022
5585d85
fix conditions for assemble changelog action
Dec 20, 2022
9e48ed8
add PR links when assemble changelog
Dec 20, 2022
8eb59dd
update doc
Dec 20, 2022
daf3a90
fix other and issues parts
Dec 20, 2022
abed7d4
information about release
Dec 21, 2022
1dcc54b
information about release
Dec 21, 2022
4357b1d
add pr links only for lines starts with '- '
Dec 21, 2022
a9fe948
update validation scripts
Dec 21, 2022
fb8fa38
remove not relevant tests
Dec 21, 2022
b8ae890
test formatting and fixes
Dec 21, 2022
bf79b11
fix tests
Dec 21, 2022
ff7a3dd
actualization changelog
Dec 21, 2022
64cd1d8
fix rename changelog script
Dec 21, 2022
8966c79
android auto running changelog strategy
Jan 3, 2023
4b65a30
fix new line symbol
Jan 3, 2023
16d5cd6
actualize changelogs
Jan 3, 2023
b084cfa
update doc for android auto
Jan 3, 2023
ffb7291
fix skip tag
Jan 4, 2023
253915e
add changelog file script
Jan 4, 2023
f8d89a7
add changelog files
Jan 4, 2023
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
31 changes: 31 additions & 0 deletions .github/workflows/assemble_changelog.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/rename_changelog_file.yml
Original file line number Diff line number Diff line change
@@ -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
84 changes: 84 additions & 0 deletions changelog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Multi-file running changelog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should definitely adapt changelog verification script... But first we have to agree on a format. I've left some suggestions.
I think we will have to check then:

  1. A file (at least one) has been added to "changelog/unreleased";
  2. The file is called PR_NUMBER.json;
  3. It's a valid json array of strings;
  4. Maybe something else, I'll have to look at the current checks.


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMO would be nice to have a script to add changelog like python add_changelog.py -f "Changelog string", where -f is feature (also should be other flags), "Changelog string" is the entry of changelog

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

- `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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's worth mentioning that you can't create 2 files in 1 directory in 1 PR. I don't think we someone would want that (I don't see any cases for that) but still we should note that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

but I mentioned it here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't say you can't create mmultiple files.

`changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about the issues directory and just changelog/unreleased?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we need PR's links only for bugfixes and features


Every push to the main or release branch Assemble changelog GitHub action will be executed:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The temporary files will be deleted, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

no, let's keep they before the release

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will those commit trigger metrics run? For now it seems so, because each PR merge produces 2 commits in the main branch.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

[skip ci] tag allows skipping CircleCI jobs and GitHub Actions


* 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about the release process? Shouldn't we move the changelog from unreleased directory to the project root and delete the unreleased one?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added more information


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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@SevaZhukov will this system work with the android auto changelog https://github.com/mapbox/mapbox-navigation-android/blob/main/libnavui-androidauto/CHANGELOG.md

All good to consider it out of scope but it would be nice if it supported multiple release channels

Empty file.
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6466.md
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 18 additions & 0 deletions changelog/unreleased/bugfixes/6678.md
Original file line number Diff line number Diff line change
@@ -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()
}
```
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6760.md
Original file line number Diff line number Diff line change
@@ -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`.
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6764.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added guarantees that route progress with `RouteProgress#currentState == OFF_ROUTE` arrives earlier than `NavigationRerouteController#reroute` is called.
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6766.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed an issue where the first voice instruction might have been played twice.
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6770.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Introduced `NavigationViewListener.onSpeedInfoClicked` that would be triggered when `MapboxSpeedInfoView` is clicked upon.
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6774.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed standalone `MapboxManeuverView` appearance when the app also integrates Drop-In UI.
Empty file.
33 changes: 33 additions & 0 deletions scripts/changelog/add_changelog.py
Original file line number Diff line number Diff line change
@@ -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')
60 changes: 60 additions & 0 deletions scripts/changelog/assemble_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import os

import git


def get_changes(path):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the testing strategy for the changelog logic? Do I understand correctly that after each change I need to manually run script locally simulating different scenarios that my change may affect? Do you think it makes sense to add auto tests, so that developers could enhance this logic without being afraid break a different scenario?

I think this question isn't a blocker for this particular PR, but it's worth to discuss 🙂

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yeah, good point, let's add tests for this logic

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()
43 changes: 43 additions & 0 deletions scripts/changelog/rename_changelog_file.py
Original file line number Diff line number Diff line change
@@ -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()
Loading