aboutsummaryrefslogtreecommitdiff
path: root/ci/common/submit_coverage.sh
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-06-25 15:35:33 +0200
committerGitHub <noreply@github.com>2019-06-25 15:35:33 +0200
commite13ae7cae641bde5cd744378051d0a7f8b892d33 (patch)
tree0da2d898862cd6be4e2e35e6b2e5adfb7bd9fe29 /ci/common/submit_coverage.sh
parent027ebb23da0868655413e1850eb0b7d77e223850 (diff)
downloadrneovim-e13ae7cae641bde5cd744378051d0a7f8b892d33.tar.gz
rneovim-e13ae7cae641bde5cd744378051d0a7f8b892d33.tar.bz2
rneovim-e13ae7cae641bde5cd744378051d0a7f8b892d33.zip
ci: revisit/fix coverage uploading (#10201)
* Add ci/common/submit_coverage.sh, used with Travis and AppVeyor * use gcovr, with coverage.xml for better branch coverage reporting, and easier processing of gcov files in general * codecov: use flags again, with `uname -s` additionally Ref: https://github.com/neovim/neovim/pull/10227#issuecomment-502923543 * remove now unused parsers.gcov config from codecov.yml
Diffstat (limited to 'ci/common/submit_coverage.sh')
-rwxr-xr-xci/common/submit_coverage.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/ci/common/submit_coverage.sh b/ci/common/submit_coverage.sh
new file mode 100755
index 0000000000..7c343268d1
--- /dev/null
+++ b/ci/common/submit_coverage.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Collect and submit coverage reports.
+#
+# Args:
+# $1: Flag(s) for codecov, separated by comma.
+
+set -ex
+
+# Change to grandparent dir (POSIXly).
+CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit
+
+echo "=== running submit_coverage in $PWD: $* ==="
+"$GCOV" --version
+
+# Download/install codecov-bash and gcovr once.
+codecov_sh="${TEMP:-/tmp}/codecov.bash"
+if ! [ -f "$codecov_sh" ]; then
+ curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash
+ chmod +x "$codecov_sh"
+
+ python3 -m pip install --quiet --user gcovr
+fi
+
+python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root build --delete -o coverage.xml --xml
+
+# Upload to codecov.
+# -X gcov: disable gcov, done manually above.
+# -Z: exit non-zero on failure
+# -F: flag(s)
+# NOTE: ignoring flags for now, since this causes timeouts on codecov.io then,
+# which they know about for about a year already...
+# Flags must match pattern ^[\w\,]+$ ("," as separator).
+codecov_flags="$(uname -s),${1}"
+codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g')
+if ! "$codecov_sh" -f coverage.xml -X gcov -Z -F "${codecov_flags}"; then
+ echo "codecov upload failed."
+fi
+
+# Cleanup always, especially collected data.
+find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l
+rm -f coverage.xml