From 7b395f6ad8f8ffe1ad7cbba2a1ea8527f3258d3e Mon Sep 17 00:00:00 2001 From: Joel Falcou Date: Wed, 21 May 2025 11:32:23 +0200 Subject: [PATCH] Setup CI on gitlab Co-authored-by: Joel Falcou See merge request oss/rotgen!5 --- .gitlab-ci.yml | 57 +++++++++++++++++++++++++++++++++++++++ CMakePresets.json | 55 +++++++++++++++++++++++++++++++++++++ include/rotgen/matrix.hpp | 2 +- 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100644 CMakePresets.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..d9d615b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,57 @@ +# https://docs.gitlab.com/ee/ci/yaml/ + +# Job templates + +.docker-job: &docker-job + tags: [docker] + cache: + paths: [/var/cache/pacman, build/] + image: archlinux/archlinux:base-devel + before_script: [./ci-cd/environment-setup.sh] + +.native-job: &native-job + tags: ["shell"] + cache: + paths: [build/] + +stages: + - build + - test + +# Native stuff + +build-debug-native: + <<: *native-job + stage: build + artifacts: + paths: + - build/debug/ + script: + - cmake --preset debug -DCMAKE_CXX_COMPILER=clang++ + - cmake --build --preset debug + +build-release-native: + <<: *native-job + stage: build + artifacts: + paths: + - build/release/ + script: + - cmake --preset release -DCMAKE_CXX_COMPILER=clang++ + - cmake --build --preset release + +test-debug-native: + <<: *native-job + needs: ["build-debug-native"] + stage: test + script: + - cmake --build --preset debug --target rotgen-test + - cd build/debug && ctest --output-on-failure + +test-release-native: + <<: *native-job + needs: ["build-release-native"] + stage: test + script: + - cmake --build --preset release --target rotgen-test + - cd build/release && ctest --output-on-failure diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..041ad83 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,55 @@ +{ + "version": 4, + "cmakeMinimumRequired": { + "major": 3, + "minor": 22, + "patch": 0 + }, + "configurePresets": [ + { + "name": "clangd", + "displayName": "ClangD", + "description": "ClangD preset, provides compile_commands.json", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_LINKER_LAUNCHER": "clang++", + "CMAKE_C_LINKER_LAUNCHER": "clang" + } + }, + { + "name": "release", + "displayName": "Release", + "description": "Release build", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + }, + { + "name": "debug", + "inherits": "release", + "displayName": "Debug", + "description": "Debug build", + "binaryDir": "${sourceDir}/build/debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + } + ], + "buildPresets": [ + { + "name": "release", + "configurePreset": "release" + }, + { + "name": "debug", + "configurePreset": "debug" + } + ] +} diff --git a/include/rotgen/matrix.hpp b/include/rotgen/matrix.hpp index 6c138d4..182ce57 100644 --- a/include/rotgen/matrix.hpp +++ b/include/rotgen/matrix.hpp @@ -36,7 +36,7 @@ namespace rotgen if constexpr(Rows != -1) assert(init.size() == Rows && "Mismatched between dynamic and static row size"); if constexpr(Cols != -1) { - std::size_t c = 0; + [[maybe_unused]] std::size_t c = 0; if(init.size()) c = init.begin()->size(); assert(c == Cols && "Mismatched between dynamic and static column size"); }