Skip to content

Commit

Permalink
[ci] Send bench results to S3 (#1417)
Browse files Browse the repository at this point in the history
* [ci] Send bench results to S3

* move publish stage
  • Loading branch information
alvicsam authored Jul 1, 2022
1 parent eff2c9e commit cc8c834
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
38 changes: 24 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
stages:
- test
- build
- publish
- benchmarks-build
- benchmarks-run
- publish

default:
interruptible: true
Expand Down Expand Up @@ -47,7 +47,6 @@ variables:
.common-refs: &common-refs
# these jobs run always*
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
Expand All @@ -56,27 +55,19 @@ variables:

.publish-refs: &publish-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web" &&
$CI_COMMIT_REF_NAME == "master" # run from web and on master branch
- if: $CI_PIPELINE_SOURCE == "web" &&
$CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # run from web and on version tag (i.e. v1.0, v2.1rc1)
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

# run benchmarks manually only on release-parachains-v* branch
.benchmarks-manual-refs: &benchmarks-manual-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web" &&
$CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # run from web and on branch release-parachains-v* (i.e. 1.0, 2.1rc1, 3)
when: manual
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
when: manual

# run benchmarks only on release-parachains-v* branch
.benchmarks-refs: &benchmarks-refs
rules:
- if: $CI_PIPELINE_SOURCE == "web" &&
$CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # run from web and on branch release-parachains-v* (i.e. 1.0, 2.1rc1, 3)
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000

.docker-env: &docker-env
Expand Down Expand Up @@ -284,9 +275,9 @@ benchmarks:
<<: *collect-artifacts
<<: *benchmarks-refs
script:
- ./scripts/benchmarks-ci.sh assets statemine > ./artifacts/bench-statemine.log
- ./scripts/benchmarks-ci.sh assets statemint > ./artifacts/bench-statemint.log
- ./scripts/benchmarks-ci.sh assets westmint > ./artifacts/bench-westmint.log
- ./scripts/benchmarks-ci.sh assets statemine
- ./scripts/benchmarks-ci.sh assets statemint
- ./scripts/benchmarks-ci.sh assets westmint
- git status
- export BRANCHNAME="weights-${CI_COMMIT_BRANCH}"
# Set git config
Expand All @@ -309,6 +300,25 @@ benchmarks:
tags:
- weights

publish-benchmarks-s3:
stage: publish
<<: *kubernetes-env
image: paritytech/awscli:latest
<<: *benchmarks-refs
needs:
- job: benchmarks
artifacts: true
variables:
GIT_STRATEGY: none
BUCKET: "releases.parity.io"
PREFIX: "cumulus/$CI_COMMIT_REF_NAME/benchmarks"
script:
- echo "___Removing binary from artifacts___"
- rm -f ./artifacts/polkadot-parachain
- echo "___Publishing benchmark results___"
- aws s3 sync ./artifacts/ s3://${BUCKET}/${PREFIX}/
after_script:
- aws s3 ls s3://${BUCKET}/${PREFIX}/ --recursive --human-readable --summarize

#### stage: .post

Expand Down
6 changes: 3 additions & 3 deletions scripts/benchmarks-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ pallets=(
frame_system
)

for p in ${pallets[@]}
for pallet in ${pallets[@]}
do
./artifacts/polkadot-parachain benchmark pallet \
--chain=$benchmarkRuntimeName \
--execution=wasm \
--wasm-execution=compiled \
--pallet=$p \
--pallet=$pallet \
--extrinsic='*' \
--steps=$steps \
--repeat=$repeat \
--json \
--header=./file_header.txt \
--output=$benchmarkOutput
--output=$benchmarkOutput >> ./artifacts/${pallet}_benchmark.json
done

0 comments on commit cc8c834

Please sign in to comment.