From: Martin Vidner Date: Thu, 23 Jan 2020 10:37:57 +0000 (+0100) Subject: Coveralls needs to access the Git repo X-Git-Tag: v0.8.9~1^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=24e5ed7a6f7ded3ba5bbb3aa6c08eb229f6ebed5;p=thirdparty%2Fsnapper.git Coveralls needs to access the Git repo --- diff --git a/.travis.tumbleweed.sh b/.travis.tumbleweed.sh index 93c01101..ca96404b 100755 --- a/.travis.tumbleweed.sh +++ b/.travis.tumbleweed.sh @@ -31,8 +31,11 @@ popd # Coverage report pushd /usr/src/packages/BUILD/snapper-* -make coveralls STRIP_PATH_PREFIX="$(pwd)" +make coverage popd +# Must call coveralls-lcov from the git directory +BUILDDIR=(/usr/src/packages/BUILD/snapper-*) # expand glob +make -f Makefile.repo coveralls BUILDDIR="${BUILDDIR[@]}" # get the plain package names and remove all packages at once rpm -ev --nodeps `rpm -q --qf '%{NAME} ' -p /usr/src/packages/RPMS/**/*.rpm` diff --git a/Makefile.am b/Makefile.am index 0610945a..696cc793 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,22 +45,14 @@ package-clean: if ENABLE_COVERAGE # Run `make coverage` after all the tests have been run. +# See also make -f Makefile.repo coveralls COVERAGE_INFO = coverage/coverage.info -.PHONY: coverage coveralls +.PHONY: coverage coverage: mkdir -p $(dir $(COVERAGE_INFO)) lcov --capture --no-external --exclude '*/testsuite*/*' --output-file $(COVERAGE_INFO) --directory . --quiet lcov --list $(COVERAGE_INFO) genhtml --output-directory coverage --legend --title "Snapper code coverage" -q $(COVERAGE_INFO) - -coveralls: coverage - ## Strip the absolute path prefix from the coverage data - ## so coveralls.io can find the source files at GitHub. - ## STRIP_PATH_PREFIX should be set at 'make' time. - sed -i -e 's#^SF:'"$${STRIP_PATH_PREFIX}"'/\(.*\)#SF:\1#' "$(COVERAGE_INFO)" - ## Send the code coverage to coveralls.io - ## COVERALLS_TOKEN is set in Travis config and passed via .travis.yml - LC_ALL=en_US.UTF-8 coveralls-lcov --repo-token "$${COVERALLS_TOKEN}" "$(COVERAGE_INFO)" endif # Create all the files necessary for building the package with OBS: diff --git a/Makefile.repo b/Makefile.repo index 7c2f6478..3cb6fba6 100644 --- a/Makefile.repo +++ b/Makefile.repo @@ -26,3 +26,15 @@ install: configure reconf: all ./config.status --recheck ./config.status + +# This needs access to the build (and test) results so you would expect it +# in Makefile.am +# But the coveralls tool needs info from the Git checkout. +COVERAGE_INFO=$(BUILDDIR)/coverage/coverage.info +coveralls: + # Strip the absolute path prefix from the coverage data + # so coveralls.io can find the source files at GitHub. + sed -i -e 's#^SF:'"$${BUILDDIR?}"'/\(.*\)#SF:\1#' "$(COVERAGE_INFO)" + # Send the code coverage to coveralls.io + # COVERALLS_TOKEN is set in Travis config and passed via .travis.yml + LC_ALL=en_US.UTF-8 coveralls-lcov --repo-token "$${COVERALLS_TOKEN}" "$(COVERAGE_INFO)"