Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add link to the weight comparison tool for weights PRs #1788

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
10 changes: 2 additions & 8 deletions scripts/ci/gitlab/pipeline/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ benchmarks-assets:
- export CURRENT_TIME=$(date '+%s')
- export BRANCHNAME="weights-statemint-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
- !reference [.git-commit-push, script]
# create PR to release-parachains-v* branch
- curl -u ${GITHUB_USER}:${GITHUB_TOKEN}
-d '{"title":"[benchmarks] Update weights for statemine/t","body":"This PR is generated automatically by CI. (Once merged please backport to master and node release branch.)","head":"'${BRANCHNAME}'","base":"'${CI_COMMIT_BRANCH}'"}'
-X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls
- ./scripts/create-benchmark-pr.sh "[benchmarks] Update weights for statemine/t" "$BRANCHNAME"
after_script:
- rm -rf .git/config
tags:
Expand All @@ -50,10 +47,7 @@ benchmarks-collectives:
- export CURRENT_TIME=$(date '+%s')
- export BRANCHNAME="weights-collectives-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
- !reference [.git-commit-push, script]
# create PR
- curl -u ${GITHUB_USER}:${GITHUB_TOKEN}
-d '{"title":"[benchmarks] Update weights for collectives","body":"This PR is generated automatically by CI.","head":"'$BRANCHNAME'","base":"'${CI_COMMIT_BRANCH}'"}'
-X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls
- ./scripts/create-benchmark-pr.sh "[benchmarks] Update weights for collectives" "$BRANCHNAME"
after_script:
- rm -rf .git/config
tags:
Expand Down
49 changes: 49 additions & 0 deletions scripts/create-benchmark-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/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"

WEIGHTS_COMPARISON_URL_PARTS=(
"https://weights.tasty.limo/compare?"
"repo=$REPO&"
"threshold=30&"
joao-paulo-parity marked this conversation as resolved.
Show resolved Hide resolved
"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.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This PR is generated automatically by CI. (Once merged please backport to master and node release branch.)
This PR is generated automatically by CI.
[ ] Backport to master and node release branch once merged

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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"