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

Commit

Permalink
include comparison URL for weights PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-paulo-parity committed Oct 20, 2022
1 parent 1219981 commit 2d8231c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/ci/gitlab/pipeline/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ benchmarks-assets:
- export CURRENT_TIME=$(date '+%s')
- export BRANCHNAME="weights-statemint-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
- !reference [.git-commit-push, script]
- export DESCRIPTION="$(./scripts/weights-pr-description.sh || :)"
# 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}'"}'
Expand Down
37 changes: 37 additions & 0 deletions scripts/weights-pr-description.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -Eeu -o pipefail
shopt -s inherit_errexit

ORG="paritytech"
REPO="$CI_PROJECT_NAME"

PR_NUMBER="$CI_COMMIT_REF_NAME"
if [[ ! "$PR_NUMBER" =~ ^[[:digit:]]+$ ]]; then
echo "Not a pull request number: $PR_NUMBER"
exit
fi

BASE_REF="$(curl \
-sSL \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$ORG/$REPO/pulls/$PR_NUMBER" | \
jq -e -r ".base.ref")"

WEIGHTS_COMPARISON_URL="$(echo "
https://weights.tasty.limo/compare?repo=$CI_PROJECT_NAME&
threshold=30&
path_pattern=**%2Fweights%2F*.rs&
method=guess-worst&
ignore_errors=true&
unit=time&
old=$BASE_REF&
new=$BRANCHNAME
" | tr -d '\n ')"

DESCRIPTION="$(echo -n \
$'\n'$'\n'"Compare the weights with \`$BASE_REF\`: $WEIGHTS_COMPARISON_URL" | \
jq -sRr @json)"

# remove the quotes around the JSON-encoded string
echo "${DESCRIPTION:1: -1}"

0 comments on commit 2d8231c

Please sign in to comment.