CICD-079 · Build and test CMake targets
Encyclopedia · Language build toolchains · All snippets
Previous · CICD-078 · Next · CICD-080
1. Where it fits
- Placement Bash run step following checkout, or equivalent lab terminal.
- Prerequisites source repository with committed build manifest and pinned matching toolchain.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel 2
ctest --test-dir build --output-on-failure --no-tests=error3. How it works
The shell predicate makes the expected state explicit and returns a nonzero status when it is not satisfied.
4. Verify the result
Enable CTest in CMakeLists.txt and expect a nonzero result on a failed test.
Validation syntax-validated (Bash parse). Status definitions.