@@ -38,20 +38,43 @@ git fetch --depth=1 --filter=blob:none origin "$branch"
3838git sparse-checkout set dummy/
3939git checkout " $branch "
4040
41- # e.g. "2022-12-29 22:09:54 UTC (6c6e440)"
42- coverage_report_name () {
43- commit_time_iso=$( git show -s --format=%cI)
44- commit_hash_short=$( git rev-parse HEAD | head -c 7)
45-
46- date " --date=$commit_time_iso " --iso-8601=seconds --utc | \
47- sed -e ' s/T/ /' -e " s/+.*/ UTC ($commit_hash_short )/"
41+ hex_encode () {
42+ string=$1
43+ while [ -n " $string " ]; do
44+ tail=${string# ?}
45+ head=${string% " $tail " }
46+ printf ' %02x' " '$head "
47+ string=$tail
48+ done
49+ printf ' \n'
4850}
4951
5052cd " $tracer_dir "
51- report_name=$( coverage_report_name)
53+
54+ commit_time_iso=$( git show -s --format=%cI)
55+ commit_hash_short=$( git rev-parse HEAD | head -c 7)
56+ commit_branch=$( git branch --show-current)
57+ branch_encoded=$( hex_encode " $commit_branch " )
58+ commit_time_iso=$( date " --date=$commit_time_iso " --iso-8601=ns --utc | \
59+ sed -e ' s/,/./g' -e ' s/......+00:00$/Z/' )
60+ coverage_lines=$( grep -A 3 Lines .coverage/report/index.html | \
61+ sed -n ' s/.*>\([0-9.]\+\).*/\1/p' | \
62+ paste -s | \
63+ awk ' {print "lines:"$1":"$2":"$3}' )
64+ coverage_funcs=$( grep -A 3 Functions .coverage/report/index.html | \
65+ sed -n ' s/.*>\([0-9.]\+\).*/\1/p' | \
66+ paste -s | \
67+ awk ' {print "funcs:"$1":"$2":"$3}' )
68+ report_name=$( printf ' %s-%s-%s-%s-%s\n' \
69+ " $commit_time_iso " \
70+ " $commit_hash_short " \
71+ " $coverage_lines " \
72+ " $coverage_funcs " \
73+ " $branch_encoded " )
74+
5275mv .coverage/report " $temp_dir /dd-trace-cpp-coverage/$report_name "
5376
5477cd " $temp_dir /dd-trace-cpp-coverage"
5578git add -A --sparse
56- git commit -m " add $report_name "
79+ git commit -m " coverage for commit $commit_hash_short on $commit_branch "
5780git push
0 commit comments