diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15a27287d2707189ad41e4d0505eb49535a788cd..3540810879c9328cf5d95558cf79b0c5cbea64f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,12 +8,15 @@ # can use verions as well, like gcc:5.2 # see https://hub.docker.com/_/gcc/ -image: rhobincu/ubuntu_build_image:1.1 +image: rhobincu/ubuntu_build_image:1.2 build-job-debug: stage: build script: - - make PROFILE=Debug Debug/main -j6 + - make PROFILE=Debug -j6 + artifacts: + paths: + - Debug/main build-job-release: stage: build @@ -21,17 +24,21 @@ build-job-release: - make PROFILE=Release -j6 artifacts: paths: - - Release/utest + - Release/main test-job-debug: stage: test script: - - make PROFILE=Debug Debug/utest -j6 + - make PROFILE=Debug COVERAGE=--coverage -j6 Debug/utest - LD_LIBRARY_PATH=/usr/local/lib/ ./Debug/utest - + - cd Debug && gcovr src/ + coverage: '/^TOTAL.*\s+(\d+\%)$/' + test-job-release: - dependencies: - - build-job-release stage: test script: - - LD_LIBRARY_PATH=/usr/local/lib/ ./Release/utest \ No newline at end of file + - make PROFILE=Release COVERAGE=--coverage -j6 Release/utest + - LD_LIBRARY_PATH=/usr/local/lib/ ./Release/utest + - cd Release && gcovr src/ + coverage: '/^TOTAL.*\s+(\d+\%)$/' + diff --git a/Makefile b/Makefile index c808f5ef25563dbee8f4a5504bf7703028c57140..e0fb42b2e3373814de54c5b2d8327ccb76e0ceaf 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ SUBDIRS = $(shell find src/ -type d) PROFILE =Release - -BASE_FLAGS = --std=c++17 -fPIC -c -MMD -I. $(addprefix -I,$(SUBDIRS)) +COVERAGE= +BASE_FLAGS = --std=c++17 -fPIC -c -MMD -I. $(addprefix -I,$(SUBDIRS)) ifeq ($(PROFILE),Release) CXXFLAGS = $(BASE_FLAGS) -O3 @@ -26,14 +26,14 @@ all: $(PROFILE)/$(EXE_NAME) $(PROFILE)/$(UTEST_NAME) #this is using a static library - .a $(PROFILE)/$(EXE_NAME): $(OBJ_FILES) - $(CXX) $^ -o $@ $(LDFLAGS) + $(CXX) $^ -o $@ $(COVERAGE) $(LDFLAGS) $(PROFILE)/src/%.o: src/%.cpp mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) $< -o $@ + $(CXX) $(CXXFLAGS) $(COVERAGE) $< -o $@ $(PROFILE)/$(UTEST_NAME): $(filter-out $(PROFILE)/src/main.o,$(OBJ_FILES)) $(TEST_OBJ_FILES) - $(CXX) $^ -o $@ -lgtest_main -lgtest $(LDFLAGS) + $(CXX) $^ -o $@ $(COVERAGE) -lgtest_main -lgtest $(LDFLAGS) $(PROFILE)/tests/%.o: tests/%.cpp mkdir -p $(dir $@)