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

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-paulo-parity committed Oct 20, 2022
1 parent 2d8231c commit 4360e49
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 79 deletions.
40 changes: 7 additions & 33 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,36 +126,10 @@ variables:
- git commit -m "[benchmarks] pr with weights"
- git push origin $BRANCHNAME

include:
# test jobs
- scripts/ci/gitlab/pipeline/test.yml
# # build jobs
- scripts/ci/gitlab/pipeline/build.yml
# # benchmarks jobs
- scripts/ci/gitlab/pipeline/benchmarks.yml
# # publish jobs
- scripts/ci/gitlab/pipeline/publish.yml
# zombienet jobs
- scripts/ci/gitlab/pipeline/zombienet.yml

#### stage: .post

# This job cancels the whole pipeline if any of provided jobs fail.
# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
# to fail the pipeline as soon as possible to shorten the feedback loop.
cancel-pipeline:
stage: .post
needs:
- job: test-linux-stable
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: on_failure
variables:
PROJECT_ID: "${CI_PROJECT_ID}"
PROJECT_NAME: "${CI_PROJECT_NAME}"
PIPELINE_ID: "${CI_PIPELINE_ID}"
FAILED_JOB_URL: "${FAILED_JOB_URL}"
FAILED_JOB_NAME: "${FAILED_JOB_NAME}"
PR_NUM: "${PR_NUM}"
trigger:
project: "parity/infrastructure/ci_cd/pipeline-stopper"
benchmarks-assets:
before_script:
- !reference [.docker-env, before_script]
script:
- ./scripts/create-benchmark-pr.sh FOO
tags:
- weights
11 changes: 2 additions & 9 deletions scripts/ci/gitlab/pipeline/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +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}'"}'
-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 @@ -51,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=$CI_PROJECT_NAME&"
"threshold=30&"
"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"

# curl \
# -u "$GITHUB_USER:$GITHUB_TOKEN" \
# -X POST \
# -d "$PAYLOAD" \
# "https://api.github.com/repos/$ORG/$REPO/pulls"
37 changes: 0 additions & 37 deletions scripts/weights-pr-description.sh

This file was deleted.

0 comments on commit 4360e49

Please sign in to comment.