forked from paritytech/cumulus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-benchmark-pr.sh
executable file
·51 lines (43 loc) · 1.1 KB
/
create-benchmark-pr.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/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. (Once merged please backport to master and node release branch.)
Compare the weights with \`$BASE_REF\`: $WEIGHTS_COMPARISON_URL
" \
--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"