-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: provide utils for release candidate post
A markdown file provides a template that can be used for a post on Discourse for discussing the current release candidate. There is also a Python script which gets a list of the closed PRs between now and the last release. Some of the output from this can be used in the template. Also provide a script for getting the current versions of crates and binaries. This can be handy if you lost the output from the bump script.
- Loading branch information
Showing
4 changed files
with
246 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Release Candidate YYYY.MM.X.Y | ||
|
||
*PLEASE DO NOT EDIT THIS POST.* | ||
|
||
It should only be edited by the RC owner, i.e., the original poster. | ||
|
||
## Binary Versions | ||
|
||
* `faucet` __REPLACE__ | ||
* `nat-detection` __REPLACE__ | ||
* `node-launchpad` __REPLACE__ | ||
* `safe` __REPLACE__ | ||
* `safenode` __REPLACE__ | ||
* `safenode-manager` __REPLACE__ | ||
* `safenodemand` __REPLACE__ | ||
* `sn_auditor` __REPLACE__ | ||
* `safenode_rpc_client` __REPLACE__ | ||
|
||
## Closed Pull Requests | ||
|
||
Replace this with the list of closed PRs since the last version. This is intended to help developers | ||
with their contributions to the changelog. | ||
|
||
## Changelog/Testing Contributions | ||
|
||
Please reply with a description of any contributions you made that will be included in this release. | ||
The list of closed PRs is provided for reference. You can also provide direction or suggestions as | ||
to how we could test your contributions with community participation. | ||
|
||
Use this checklist to track the changelog contributions that are needed. | ||
|
||
*Remove people who didn't close any PRs during this cycle.* | ||
|
||
You will be ticked off when your reply is provided: | ||
|
||
- [] Anselme | ||
- [] Benno | ||
- [] Chris | ||
- [] Josh | ||
- [] Mazzi | ||
- [] Mick | ||
- [] Qi | ||
- [] Roland | ||
|
||
## Contribution Template | ||
|
||
To provide your contributions for the changelog, the template below can be used: | ||
``` | ||
### Network | ||
#### Added | ||
- Provide any added entries or remove the section if it doesn't apply | ||
#### Changed | ||
- Provide any changed entries or remove the section if it doesn't apply | ||
#### Fixed | ||
- Provide any fixed entries or remove the section if it doesn't apply | ||
### Client | ||
#### Added | ||
- Provide any added entries or remove the section if it doesn't apply | ||
#### Changed | ||
- Provide any changed entries or remove the section if it doesn't apply | ||
#### Fixed | ||
- Provide any fixed entries or remove the section if it doesn't apply | ||
### Node Manager | ||
#### Added | ||
- Provide any added entries or remove the section if it doesn't apply | ||
#### Changed | ||
- Provide any changed entries or remove the section if it doesn't apply | ||
#### Fixed | ||
- Provide any fixed entries or remove the section if it doesn't apply | ||
### Launchpad | ||
Remove whole section if it does not apply. | ||
#### Added | ||
- Provide any added entries or remove the section if it doesn't apply | ||
#### Changed | ||
- Provide any changed entries or remove the section if it doesn't apply | ||
#### Fixed | ||
- Provide any fixed entries or remove the section if it doesn't apply | ||
``` | ||
|
||
If you have any suggestions for testing your contributions with the community, please add them to | ||
your reply, or provide them as a separate reply in the thread. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import sys | ||
from collections import defaultdict | ||
from github import Github | ||
|
||
def has_breaking_change(commits): | ||
for commit in commits: | ||
commit_message = commit.commit.message | ||
if '!' in commit_message.split('\n')[0] or 'BREAKING CHANGE' in commit_message: | ||
return True | ||
return False | ||
|
||
|
||
def main(last_released_pr_number): | ||
token = os.getenv("GITHUB_PAT_SAFE_NETWORK_PR_LIST") | ||
if not token: | ||
raise Exception("The GITHUB_PAT_SAFE_NETWORK_PR_LIST environment variable must be set") | ||
|
||
g = Github(token) | ||
repo = g.get_repo("maidsafe/safe_network") | ||
|
||
last_released_pr = repo.get_pull(last_released_pr_number) | ||
if not last_released_pr: | ||
raise Exception(f"Could not retrieve PR #{last_released_pr_number}") | ||
last_release_date = last_released_pr.closed_at | ||
if not last_release_date: | ||
raise Exception(f"PR #{last_released_pr_number} has not been merged") | ||
|
||
print("Base comparison PR:") | ||
print(f"#{last_released_pr.number}: {last_released_pr.title} closed at {last_released_pr.closed_at}") | ||
print() | ||
|
||
pulls = repo.get_pulls(state="closed", sort="updated", direction="desc") | ||
filtered_pulls = [] | ||
for pr in pulls: | ||
if not pr.closed_at: | ||
print(f"PR {pr.number} is not closed yet") | ||
continue | ||
print(f"Processing PR {pr.number}...") | ||
if pr.closed_at <= last_release_date: | ||
break | ||
if pr.merged_at: | ||
commits = pr.get_commits() | ||
breaking = has_breaking_change(commits) | ||
filtered_pulls.append({ | ||
"number": pr.number, | ||
"title": pr.title, | ||
"author": pr.user.login, | ||
"closed_at": pr.closed_at, | ||
"breaking": breaking, | ||
"commits": commits | ||
}) | ||
filtered_pulls.sort(key=lambda pr: pr["closed_at"]) | ||
|
||
print("Flat list:") | ||
for pr in filtered_pulls: | ||
closed_date = pr["closed_at"].date() | ||
breaking_text = "[BREAKING]" if pr["breaking"] else "" | ||
print(f"{closed_date} #{pr['number']} -- {pr['title']} [@{pr['author']}] {breaking_text}") | ||
|
||
print() | ||
grouped_pulls = defaultdict(list) | ||
for pr in filtered_pulls: | ||
grouped_pulls[pr["author"]].append(pr) | ||
|
||
print("Grouped by author:") | ||
for author, prs in grouped_pulls.items(): | ||
print(f"@{author}") | ||
for pr in prs: | ||
closed_date = pr["closed_at"].date() | ||
breaking_text = "[BREAKING]" if pr["breaking"] else "" | ||
print(f" {closed_date} #{pr['number']} -- {pr['title']} {breaking_text}") | ||
print() | ||
|
||
print("Grouped by author with commits:") | ||
for author, prs in grouped_pulls.items(): | ||
print(f"@{author}") | ||
for pr in prs: | ||
closed_date = pr["closed_at"].date() | ||
breaking_text = "[BREAKING]" if pr["breaking"] else "" | ||
print(f" {closed_date} #{pr['number']} -- {pr['title']} {breaking_text}") | ||
for commit in pr["commits"]: | ||
print(f" {commit.commit.message.split('\n')[0]}") | ||
print() | ||
|
||
print("Grouped by author markdown:") | ||
for author, prs in grouped_pulls.items(): | ||
print(f"@{author}") | ||
for pr in prs: | ||
pr_number = pr["number"] | ||
closed_date = pr["closed_at"].date() | ||
breaking_text = "[BREAKING]" if pr["breaking"] else "" | ||
print(f" {closed_date} [#{pr_number}](https://github.com/maidsafe/safe_network/pull/{pr_number}) -- {pr['title']} {breaking_text}") | ||
print() | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
print("Usage: python script.py <last_release_pr_number>") | ||
sys.exit(1) | ||
|
||
last_release_pr_number = int(sys.argv[1]) | ||
main(last_release_pr_number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
all_crates=($(awk '/members = \[/{flag=1; next} /\]/{flag=0} flag {gsub(/[",]/, ""); print $0}' \ | ||
Cargo.toml)) | ||
|
||
echo "==================" | ||
echo " Crate Versions " | ||
echo "==================" | ||
for crate in "${all_crates[@]}"; do | ||
version=$(grep "^version" < $crate/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g') | ||
echo "$crate: $version" | ||
done | ||
|
||
echo "===================" | ||
echo " Binary Versions " | ||
echo "===================" | ||
echo "faucet: $(grep "^version" < sn_faucet/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "nat-detection: $(grep "^version" < nat-detection/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "node-launchpad: $(grep "^version" < node-launchpad/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "safe: $(grep "^version" < sn_cli/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "safenode: $(grep "^version" < sn_node/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "safenode-manager: $(grep "^version" < sn_node_manager/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "safenode_rpc_client: $(grep "^version" < sn_node_rpc_client/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "safenodemand: $(grep "^version" < sn_node_manager/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" | ||
echo "sn_auditor: $(grep "^version" < sn_auditor/Cargo.toml | head -n 1 | awk '{ print $3 }' | sed 's/\"//g')" |