diff --git a/resources/rc_template.md b/resources/rc_template.md new file mode 100644 index 0000000000..9ad5f0f5b9 --- /dev/null +++ b/resources/rc_template.md @@ -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. diff --git a/resources/scripts/bump_version_for_rc.sh b/resources/scripts/bump_version_for_rc.sh index 4e883c7429..655345e199 100755 --- a/resources/scripts/bump_version_for_rc.sh +++ b/resources/scripts/bump_version_for_rc.sh @@ -4,6 +4,9 @@ set -e # This script must run from the root of the repository. +# This allows for, e.g., "alpha" to be passed when calling the script. +pre_release_identifer=${1:-"rc"} + all_crates=($(awk '/members = \[/{flag=1; next} /\]/{flag=0} flag {gsub(/[",]/, ""); print $0}' \ Cargo.toml)) @@ -16,8 +19,7 @@ fi declare -A crates_bumped crates_bumped_with_version=() -# Remove the --allow-dirty flag -release-plz update --allow-dirty 2>&1 | tee bump_version_output +release-plz update 2>&1 | tee bump_version_output while IFS= read -r line; do # Sometimes this list can include crates that were not bumped. The presence of "->" indicates @@ -38,7 +40,7 @@ git checkout -- . for crate in "${crates_bumped_with_version[@]}"; do name=$(echo "$crate" | sed -E 's/-v.*$//') version=$(echo "$crate" | sed -E 's/^.*-v(.*)$/\1/') - new_version="$version-rc.1" + new_version="${version}-${pre_release_identifer}.1" echo "Setting $crate to $new_version" cargo set-version --package $name $new_version done @@ -60,7 +62,7 @@ for crate in "${all_crates[@]}"; do IFS='.' read -r major minor patch <<< "$version" patch=$((patch + 1)) - new_version="${major}.${minor}.${patch}-rc.1" + new_version="${major}.${minor}.${patch}-${pre_release_identifer}.1" echo "Safety bump to $new_version" cargo set-version --package $crate $new_version diff --git a/resources/scripts/list-safe-network-closed-prs.py b/resources/scripts/list-safe-network-closed-prs.py new file mode 100755 index 0000000000..a95f9385d8 --- /dev/null +++ b/resources/scripts/list-safe-network-closed-prs.py @@ -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 ") + sys.exit(1) + + last_release_pr_number = int(sys.argv[1]) + main(last_release_pr_number) diff --git a/resources/scripts/print-versions.sh b/resources/scripts/print-versions.sh new file mode 100755 index 0000000000..b2a75fdb49 --- /dev/null +++ b/resources/scripts/print-versions.sh @@ -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')"