Skip to content

Commit

Permalink
clean up the pr diff message (#6098)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MasslessParticle authored May 4, 2022
1 parent 4f75939 commit 03153e8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
17 changes: 10 additions & 7 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1164,6 +1167,6 @@ kind: secret
name: deploy_config
---
kind: signature
hmac: 4596e741ac788d461b3bbb2429c1f61efabaf943aeec6b3cd59eeff8d769de5e
hmac: e3f0cead040a655e51244d5d71377a4ba506d7f63fae440593f6e7d14018a1e3

...
7 changes: 6 additions & 1 deletion tools/diff_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ 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}')
new=$(grep "pkg/${pkg}\s" "$2" | sed s/%// | awk '{print $5}')
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 '```'

0 comments on commit 03153e8

Please sign in to comment.