message: Add dhat pipeline
diff: @@ -4352,3 +4352,48 @@ depends_on:
  - mainnet-offline-tests
  - florencenet-offline-tests
  - granadanet-offline-tests
  +
  +---
  +##############################################################################################################
  +# This pipeline runs valgrind dhat against `decode_stream` test on current and target branches
  +# comparing total dynamic memory allocation amount and failing if the current is increased more than 10%
  +##############################################################################################################
  +kind: pipeline
  +name: dhat-decoding
  +
  +workspace:
  + path: /drone/src
  +
  +environment:
  + TARGET_BRANCH: ${DRONE_TARGET_BRANCH}
  + SOURCE_BRANCH: ${DRONE_SOURCE_BRANCH}
  +
  +steps:
  +
  +- name: run-dhat
  + image: simplestakingcom/tezedge-ci-builder:latest
  + user: root
  + commands:
  + - git remote add -f upstream https://github.com/tezedge/tezedge.git
  + - apt update && apt install -y valgrind
  + - cd tezos/messages
  + - cargo build --message-format json --test decode_stream | jq --raw-output '.executable // empty' > source.cmd
  + - valgrind --tool=exp-dhat --show-top-n=1 $(cat source.cmd) 2>&1 | tee dhat-source.out | sed '/======== ORDERED BY/Q'
  + - git checkout -B target-branch upstream/$TARGET_BRANCH
  + - cargo clean && cargo build --message-format json --test decode_stream | jq --raw-output '.executable // empty' > target.cmd
  + - valgrind --tool=exp-dhat --show-top-n=1 $(cat target.cmd) 2>&1 | tee dhat-target.out | sed '/======== ORDERED BY/Q'
  + - 'source_total=$(grep "tot_alloc" < dhat-source.out | sed -E -e "s/.*tot_alloc: *([0-9,]*).*/\\\\1/" -e "s/,//g")'
  + - 'target_total=$(grep "tot_alloc" < dhat-target.out | sed -E -e "s/.*tot_alloc: *([0-9,]*).*/\\\\1/" -e "s/,//g")'
  + - delta=$((source_total - target_total))
  + - echo Memory allocation delta $delta
  + - test $delta -le 0 && echo 'Decreased or unchanged' && exit 0
  + - test $((delta * 20)) -le $target_total && echo 'Increase within 5%' && exit 0
  + - echo 'Increase is more than 5%' && exit 1
  +
  +image_pull_secrets:
  + - docker_pull_secret
  +
  +trigger:
  + branch:
  + - master
  + - develop
  