summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-02-19 18:29:58 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-02-20 11:43:42 +0200
commit1dbfbfe7e3dfa212fa8b63f1f31e2839341c745e (patch)
tree6a72ad668bc45379c753385729321630788b9c0f /scripts
parent675a628aa2830c6b76580104f50205514664b3e9 (diff)
downloadqtlocation-mapboxgl-1dbfbfe7e3dfa212fa8b63f1f31e2839341c745e.tar.gz
[tests] Upload coverage reports to coveralls.io
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/coveralls.sh37
-rw-r--r--scripts/main.mk3
2 files changed, 40 insertions, 0 deletions
diff --git a/scripts/coveralls.sh b/scripts/coveralls.sh
new file mode 100755
index 0000000000..79e398dc1f
--- /dev/null
+++ b/scripts/coveralls.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
+
+mapbox_time "install_lcov" \
+mason install lcov 1.12
+
+LCOV="`mason prefix lcov 1.12`/usr/bin/lcov"
+
+mapbox_time "check_mason_lcov" \
+command -v $LCOV > /dev/null 2>&1 || exit 1
+
+mapbox_time "remove_coverage_info" \
+rm -f "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info"
+
+# Run all unit tests
+./scripts/run_tests.sh "build/${HOST_SLUG}/${BUILDTYPE}/test"
+
+# Collect coverage data and save it into coverage.info
+mapbox_time "lcov_capture" \
+$LCOV \
+ --quiet \
+ --capture \
+ --no-external \
+ --gcov-tool "gcov-4.9" \
+ --directory "src/mbgl" \
+ --directory "platform" \
+ --directory "include/mbgl" \
+ --directory "build/${HOST_SLUG}/${BUILDTYPE}" \
+ --base-directory "build/${HOST_SLUG}/${BUILDTYPE}" \
+ --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info"
+
+mapbox_time "coveralls_upload" \
+coveralls-lcov "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info"
diff --git a/scripts/main.mk b/scripts/main.mk
index de49c9967a..a215be635f 100644
--- a/scripts/main.mk
+++ b/scripts/main.mk
@@ -174,6 +174,9 @@ test-%: Makefile/test
check: Makefile/test
./scripts/collect-coverage.sh
+coveralls: Makefile/test
+ ./scripts/coveralls.sh
+
#### Helper targets ############################################################
.PHONY: print-env