From 03153e89bffafb6551667ce00e20046089b3a4cc Mon Sep 17 00:00:00 2001 From: Travis Patterson Date: Wed, 4 May 2022 15:38:58 -0600 Subject: [PATCH] clean up the pr diff message (#6098) * clean up the pr diff message * add dependency to clone-main to avoid possible race * don't start tests before everything is cloned * formatting change --- .drone/drone.jsonnet | 4 ++-- .drone/drone.yml | 17 ++++++++++------- tools/diff_coverage.sh | 7 ++++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 4c8e145b76..66fd88ab28 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -373,8 +373,8 @@ local manifest(apps) = pipeline('manifest') { steps: [ make('check-drone-drift', container=false) { depends_on: ['clone'] }, make('check-generated-files', container=false) { depends_on: ['clone'] }, - make('test', container=false) { depends_on: ['clone'] }, - run('clone-main', commands=['cd ..', 'git clone $CI_REPO_REMOTE loki-main', 'cd -']), + run('clone-main', commands=['cd ..', 'git clone $CI_REPO_REMOTE loki-main', 'cd -']) { depends_on: ['clone'] }, + make('test', container=false) { depends_on: ['clone', 'clone-main'] }, run('test-main', commands=['cd ../loki-main', 'BUILD_IN_CONTAINER=false make test']) { depends_on: ['clone-main'] }, make('compare-coverage', container=false, args=[ 'old=../loki-main/test_results.txt', diff --git a/.drone/drone.yml b/.drone/drone.yml index a9a1b250eb..a5c5b8366c 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -51,19 +51,22 @@ steps: image: grafana/loki-build-image:0.20.4 name: check-generated-files - commands: - - make BUILD_IN_CONTAINER=false test + - cd .. + - git clone $CI_REPO_REMOTE loki-main + - cd - depends_on: - clone environment: {} image: grafana/loki-build-image:0.20.4 - name: test + name: clone-main - commands: - - cd .. - - git clone $CI_REPO_REMOTE loki-main - - cd - + - make BUILD_IN_CONTAINER=false test + depends_on: + - clone + - clone-main environment: {} image: grafana/loki-build-image:0.20.4 - name: clone-main + name: test - commands: - cd ../loki-main - BUILD_IN_CONTAINER=false make test @@ -1164,6 +1167,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 4596e741ac788d461b3bbb2429c1f61efabaf943aeec6b3cd59eeff8d769de5e +hmac: e3f0cead040a655e51244d5d71377a4ba506d7f63fae440593f6e7d14018a1e3 ... diff --git a/tools/diff_coverage.sh b/tools/diff_coverage.sh index 188821e912..ffb21eadf2 100755 --- a/tools/diff_coverage.sh +++ b/tools/diff_coverage.sh @@ -5,6 +5,11 @@ if [[ ! -f "$1" ]] || [[ ! -f "$2" ]]; then exit 0 fi +echo +echo +echo '**Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.**' +echo + echo '```diff' for pkg in ${3//,/ }; do old=$(grep "pkg/${pkg}\s" "$1" | sed s/%// | awk '{print $5}') @@ -12,7 +17,7 @@ for pkg in ${3//,/ }; do echo | awk -v pkg="${pkg}" -v old="${old:-0}" -v new="${new:-0}" \ '{ sign=new - old < 0 ? "-" : "+" - printf ("%s %11s\t%s\n", sign, pkg, new - old) + printf ("%s %18s\t%s%%\n", sign, pkg, new - old) }' done echo '```'