Setup CI on gitlab

Co-authored-by: Joel Falcou <joel.falcou@lri.fr>

See merge request oss/rotgen!5
This commit is contained in:
Joel Falcou 2025-05-21 11:32:23 +02:00
parent 95ae1ef1e4
commit 7b395f6ad8
3 changed files with 113 additions and 1 deletions

57
.gitlab-ci.yml Normal file
View file

@ -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

55
CMakePresets.json Normal file
View file

@ -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"
}
]
}

View file

@ -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");
}