Build and package a C++ project
This tutorial builds a C++ project with CMake, publishes CTest results, and generates an installable package.
The project must register tests with CTest and generate CPackConfig.cmake. Omit the corresponding action when the source project does not provide that capability.
Configure the actions
- Git Clone
-
Set the repository URL and use
sourceas the target directory. - CMake Build
-
Set source directory to
source, build directory tobuild, generator toNinja, and build type toRelease. - CMake Test
-
Set build directory to
buildand report file tobuild/test-results/ctest.xml. - CPack Package
-
Set configuration to
build/CPackConfig.cmakeand chooseDEB,TGZ, or another supported generator.
ICE-1.0.0
codinamo >= 1.0.0
@pipeline {
name: "cpp-build"
description: "Build a CMake application"
environment: "default"
continueOnError: false
@actions {
clone: action.GIT_CLONE({
params: {
repositoryUrl: "https://example.com/team/application.git",
targetDirectory: "source"
}
})
cmake_build: action.CMAKE_BUILD({
params: {
buildDir: "build",
buildType: "Release",
generator: "Ninja",
sourceDir: "source"
}
})
cmake_test: action.CMAKE_TEST({
params: {
buildDir: "build",
outputOnFailure: true,
reportFile: "build/test-results/ctest.xml"
}
})
package: action.CPACK_PACKAGE({
params: {
configFile: "build/CPackConfig.cmake",
generator: "DEB",
packageDirectory: "dist/packages"
}
})
}
@flow {
clone -> cmake_build -> cmake_test -> package
}
}
CMAKE_TEST sends its JUnit summary to the run page. CPACK_PACKAGE exports package_file, package_files, and package_directory, allowing a later S3 or Bunny Storage action to upload the generated artifact.