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