Skip to content
Snippets Groups Projects
Verified Commit 88043c67 authored by Maik Nijhuis's avatar Maik Nijhuis
Browse files

Misc improvements and fixes

parent f3e4e881
No related branches found
No related tags found
1 merge request!2Various improvements
build/
.vscode/
......@@ -40,13 +40,11 @@ build-docker-ubuntu-22.04:
stage: prepare
needs: ["versioning"]
image: docker:latest
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
script:
- |
if ! docker manifest inspect $BASE_IMAGE > /dev/null || [ "$BUILD_DOCKER_IMAGE" = "1" ]; then
docker build --tag $BASE_IMAGE -f ci/ubuntu_22_04-base .
docker push $BASE_IMAGE
fi
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
......@@ -3,7 +3,7 @@
include: .gitlab-ci.common.yml
lint:
format:
stage: linting
needs: ["versioning", "build-docker-ubuntu-22.04"]
image: $BASE_IMAGE
......@@ -13,13 +13,20 @@ lint:
- git diff > format.patch
# Fail when the patch is not empy (note ! can't be used directly.)
- (! grep -q '^--- a' format.patch)
artifacts:
when: on_failure
paths:
- format.patch
tidy:
stage: linting
needs: ["versioning", "build-docker-ubuntu-22.04"]
image: $BASE_IMAGE
script:
- mkdir build
- cd build
- cmake -DCMAKE_CXX_CLANG_TIDY=clang-tidy -G Ninja ..
- ninja
artifacts:
paths:
- format.patch
test:
stage: test
......@@ -28,7 +35,7 @@ test:
script:
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTINDBUILD_TESTSG=ON -DCMAKE_CXX_FLAGS="-coverage" -DCMAKE_EXE_LINKER_FLAGS="-coverage" -G Ninja ..
- cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS="-coverage" -DCMAKE_EXE_LINKER_FLAGS="-coverage" -G Ninja ..
- ninja
- ctest --output-on-failure |& tee ctest.out
- mkdir coverage
......@@ -57,10 +64,13 @@ build:
pages:
stage: pages
needs: ["versioning", "build-docker-ubuntu-22.04"]
needs: ["versioning", "test"]
image: $BASE_IMAGE
script:
- mkdir build
# Generate documentation.
- cd build
- cmake -DBUILD_DOCUMENTATION=ON -G Ninja ..
- ninja sphinx
# Extract HTML coverage report.
- tar xfz coverage.tar.gz
# TODO: Add an index page with links to the documentation and coverage.
......@@ -14,6 +14,7 @@ option(BUILD_TESTING "Build the test suite" OFF)
option(BUILD_DOCUMENTATION "Build the documentation" OFF)
add_subdirectory(src)
if(BUILD_TESTING)
include(CTest)
add_subdirectory(test)
......
......@@ -6,11 +6,10 @@ find_package(
COMPONENTS unit_test_framework
REQUIRED)
add_executable(unittests main.cpp hello.cpp)
add_executable(unittests main.cpp thello.cpp)
target_link_libraries(unittests PRIVATE hello Boost::unit_test_framework)
add_test(
NAME unittests
COMMAND unittests -f JUNIT -k unittests.xml
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIRECTORY}")
COMMAND unittests -f JUNIT -k unittests.xml)
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment