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
pull/6008/head
Travis Patterson 4 years ago committed by GitHub
parent 4f75939efb
commit 03153e89bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .drone/drone.jsonnet
  2. 17
      .drone/drone.yml
  3. 7
      tools/diff_coverage.sh

@ -373,8 +373,8 @@ local manifest(apps) = pipeline('manifest') {
steps: [ steps: [
make('check-drone-drift', container=false) { depends_on: ['clone'] }, make('check-drone-drift', container=false) { depends_on: ['clone'] },
make('check-generated-files', 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 -']) { depends_on: ['clone'] },
run('clone-main', commands=['cd ..', 'git clone $CI_REPO_REMOTE loki-main', 'cd -']), 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'] }, run('test-main', commands=['cd ../loki-main', 'BUILD_IN_CONTAINER=false make test']) { depends_on: ['clone-main'] },
make('compare-coverage', container=false, args=[ make('compare-coverage', container=false, args=[
'old=../loki-main/test_results.txt', 'old=../loki-main/test_results.txt',

@ -51,19 +51,22 @@ steps:
image: grafana/loki-build-image:0.20.4 image: grafana/loki-build-image:0.20.4
name: check-generated-files name: check-generated-files
- commands: - commands:
- make BUILD_IN_CONTAINER=false test - cd ..
- git clone $CI_REPO_REMOTE loki-main
- cd -
depends_on: depends_on:
- clone - clone
environment: {} environment: {}
image: grafana/loki-build-image:0.20.4 image: grafana/loki-build-image:0.20.4
name: test name: clone-main
- commands: - commands:
- cd .. - make BUILD_IN_CONTAINER=false test
- git clone $CI_REPO_REMOTE loki-main depends_on:
- cd - - clone
- clone-main
environment: {} environment: {}
image: grafana/loki-build-image:0.20.4 image: grafana/loki-build-image:0.20.4
name: clone-main name: test
- commands: - commands:
- cd ../loki-main - cd ../loki-main
- BUILD_IN_CONTAINER=false make test - BUILD_IN_CONTAINER=false make test
@ -1164,6 +1167,6 @@ kind: secret
name: deploy_config name: deploy_config
--- ---
kind: signature kind: signature
hmac: 4596e741ac788d461b3bbb2429c1f61efabaf943aeec6b3cd59eeff8d769de5e hmac: e3f0cead040a655e51244d5d71377a4ba506d7f63fae440593f6e7d14018a1e3
... ...

@ -5,6 +5,11 @@ if [[ ! -f "$1" ]] || [[ ! -f "$2" ]]; then
exit 0 exit 0
fi 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' echo '```diff'
for pkg in ${3//,/ }; do for pkg in ${3//,/ }; do
old=$(grep "pkg/${pkg}\s" "$1" | sed s/%// | awk '{print $5}') 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}" \ echo | awk -v pkg="${pkg}" -v old="${old:-0}" -v new="${new:-0}" \
'{ '{
sign=new - old < 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 done
echo '```' echo '```'

Loading…
Cancel
Save