This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 380
Add link to the weight comparison tool for weights PRs #1788
Merged
paritytech-processbot
merged 4 commits into
paritytech:master
from
joao-paulo-parity:weights-description
Oct 21, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -Eeu -o pipefail | ||
shopt -s inherit_errexit | ||
|
||
PR_TITLE="$1" | ||
HEAD_REF="$2" | ||
|
||
ORG="paritytech" | ||
REPO="$CI_PROJECT_NAME" | ||
BASE_REF="$CI_COMMIT_BRANCH" | ||
# Change threshold in %. Bigger values excludes the small changes. | ||
THRESHOLD=${THRESHOLD:-30} | ||
|
||
WEIGHTS_COMPARISON_URL_PARTS=( | ||
"https://weights.tasty.limo/compare?" | ||
"repo=$REPO&" | ||
"threshold=$THRESHOLD&" | ||
"path_pattern=**%2Fweights%2F*.rs&" | ||
"method=guess-worst&" | ||
"ignore_errors=true&" | ||
"unit=time&" | ||
"old=$BASE_REF&" | ||
"new=$HEAD_REF" | ||
) | ||
printf -v WEIGHTS_COMPARISON_URL %s "${WEIGHTS_COMPARISON_URL_PARTS[@]}" | ||
|
||
PAYLOAD="$(jq -n \ | ||
--arg title "$PR_TITLE" \ | ||
--arg body " | ||
This PR is generated automatically by CI. | ||
|
||
Compare the weights with \`$BASE_REF\`: $WEIGHTS_COMPARISON_URL | ||
|
||
- [ ] Backport to master and node release branch once merged | ||
" \ | ||
--arg base "$BASE_REF" \ | ||
--arg head "$HEAD_REF" \ | ||
'{ | ||
title: $title, | ||
body: $body, | ||
head: $head, | ||
base: $base | ||
}' | ||
)" | ||
|
||
echo "PAYLOAD: $PAYLOAD" | ||
|
||
curl \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-X POST \ | ||
-d "$PAYLOAD" \ | ||
"https://api.github.com/repos/$ORG/$REPO/pulls" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joao-paulo-parity I know that it's merged, but please add a description what the script does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I did not find a good doc standard for bash scripts yet but I ended up using 2
#
such as## Some doc
in a bunch of scripts.That allows extracting the "doc" of a script easily while leaving the comments aside. This is especially useful when using
fzf
as you can use the preview feature to show the doc with a simple grep. This is what the (WIP)rel
scripts do:Happy to hear about better options though.