]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
CI coverage: build coverage report and publish to pages
authorMarek Vavruša <mvavrusa@cloudflare.com>
Wed, 29 Nov 2017 21:24:55 +0000 (13:24 -0800)
committerPetr Špaček <petr.spacek@nic.cz>
Sat, 23 Dec 2017 22:48:16 +0000 (23:48 +0100)
Beware: this version does not handle parallel execution

.gitlab-ci.yml
Makefile
platform.mk

index 8a856de1fffe36db77fd4e5aeb9eec0b897c2133..c60c3a6b612aa1daec32572858c2d5c7a1e8e8d7 100644 (file)
@@ -30,7 +30,7 @@ test:linux:amd64:
   stage: test
   script:
     - PREFIX=$(pwd)/.local make -k check
-    - make coverage-c COVERAGE_STAGE=gcov-check
+    - PREFIX=$(pwd)/.local make coverage-c COVERAGE_STAGE=gcov-check
   dependencies:
     - build:linux:amd64
   artifacts:
@@ -46,7 +46,7 @@ installcheck:linux:amd64:
   stage: test
   script:
     - PREFIX=$(pwd)/.local make -k installcheck
-    - make coverage-c coverage-lua COVERAGE_STAGE=gcov-installcheck
+    - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-installcheck
   dependencies:
     - build:linux:amd64
   artifacts:
@@ -62,7 +62,7 @@ deckard:linux:amd64:
   stage: test
   script:
     - PREFIX=$(pwd)/.local MAKEFLAGS="--jobs $(nproc) --keep-going" make check-integration
-    - make coverage-c coverage-lua COVERAGE_STAGE=gcov-deckard
+    - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-deckard
   dependencies:
     - build:linux:amd64
   artifacts:
@@ -132,6 +132,8 @@ respdiff:iter:udp:linux:amd64:
     - cat results/respdiff.txt
     - echo 'test if mismatch rate >= 1 %'
     - grep -q '^target diagrees.*0\.[0-9][0-9] %' results/respdiff.txt
+    - killall --wait kresd
+    - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-respdiff-iter-udp
   dependencies:
     - build:linux:amd64
   artifacts:
@@ -139,6 +141,7 @@ respdiff:iter:udp:linux:amd64:
     expire_in: '1 week'
     paths:
       - results/*.txt
+      - ./*.info
   tags:
     - docker
     - linux
@@ -152,6 +155,8 @@ respdiff:iter:tcp:linux:amd64:
     - cat results/respdiff.txt
     - echo 'test if mismatch rate >= 1 %'
     - grep -q '^target diagrees.*0\.[0-9][0-9] %' results/respdiff.txt
+    - killall --wait kresd
+    - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-respdiff-iter-tcp
   dependencies:
     - build:linux:amd64
   artifacts:
@@ -159,6 +164,7 @@ respdiff:iter:tcp:linux:amd64:
     expire_in: '1 week'
     paths:
       - results/*.txt
+      - ./*.info
   tags:
     - docker
     - linux
@@ -172,6 +178,8 @@ respdiff:iter:tls:linux:amd64:
     - cat results/respdiff.txt
     - echo 'test if mismatch rate >= 1 %'
     - grep -q '^target diagrees.*0\.[0-9][0-9] %' results/respdiff.txt
+    - killall --wait kresd
+    - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-respdiff-iter-tls
   dependencies:
     - build:linux:amd64
   artifacts:
@@ -179,20 +187,30 @@ respdiff:iter:tls:linux:amd64:
     expire_in: '1 week'
     paths:
       - results/*.txt
+      - ./*.info
   tags:
     - docker
     - linux
     - amd64
 
-coverage:linux:amd64:
+pages:
   stage: deploy
   script:
-    - make coverage
+    - PREFIX=$(pwd)/.local make coverage
+    - mv coverage/ public/
   coverage: '/lines\.+:\s(\d+.\d+\%)/'
   dependencies:
+    - build:linux:amd64
     - test:linux:amd64
     - installcheck:linux:amd64
     - deckard:linux:amd64
+    - respdiff:iter:udp:linux:amd64
+    - respdiff:iter:tcp:linux:amd64
+    - respdiff:iter:tls:linux:amd64
+  artifacts:
+    expire_in: 30 days
+    paths:
+      - public
   tags:
     - docker
     - linux
index 1d3cc8a9cd4c2d96e8bff3a7d3587342ca37ff82..abb5bde67bbede15ec538bc1e8b74e30f495786a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,14 +12,15 @@ lint: $(patsubst %.lua.in,%.lua,$(wildcard */*/*.lua.in))
        luacheck --codes --formatter TAP .
 coverage-c:
        @echo "# C coverage in $(COVERAGE_STAGE).c.info"
-       @$(LCOV) --no-external --capture --directory . --output-file $(COVERAGE_STAGE).c.info > /dev/null
+       @$(LCOV) --no-external --capture -d lib -d daemon -d modules -o $(COVERAGE_STAGE).c.info > /dev/null
 coverage-lua: $(wildcard */*/luacov.stats.out)
        @echo "# Lua coverage in $(COVERAGE_STAGE).lua.info"
        @if [ ! -z "$^" ]; then ./scripts/luacov_to_info.lua $^ > $(COVERAGE_STAGE).lua.info; fi
 coverage:
        @$(LCOV) $(addprefix --add-tracefile ,$(wildcard $(COVERAGE_STAGE)*.info)) --output-file coverage.info
+       @$(GENHTML) -q --ignore-errors source -o coverage -p $(realpath $(CURDIR)) -t "Knot DNS Resolver $(VERSION)-$(PLATFORM) coverage report" --legend coverage.info
 
-.PHONY: all install check clean doc info
+.PHONY: all install check clean doc info coverage
 
 # Options
 ifdef COVERAGE
index 6df6ee9eddb2b5ab90655a032d2fc6dca03e678f..466e0c2e246ce88e3deb239af93526306a5355ab 100644 (file)
@@ -9,6 +9,7 @@ GO := go
 CAT := cat
 SED := sed
 LCOV := lcov
+GENHTML := genhtml
 LIBEXT := .so
 AREXT  := .a
 LIBTYPE := shared