Having already established a simple CI pipeline, it is very easy to extend it with testing. Since we are already using CMake and CTest for the building and testing process, all we need to do is add another step to our pipeline that will execute the tests. This step may look like this:
# Run the unit tests with ctest
test:
stage: test
script:
- cd build
- ctest .
An entire pipeline will therefore appear as follows:
cache:
key: all
paths:
- .conan
- build
default:
image: conanio/gcc9
stages:
- prerequisites
- build
- test # We add another stage that tuns the tests
before_script:
- export CONAN_USER_HOME="$CI_PROJECT_DIR"
prerequisites:
stage: prerequisites
script:
- pip install conan==1.34.1
- conan profile new default || true
- conan profile update settings.compiler=gcc default
- conan profile update settings.compiler.libcxx=libstdc++11 default
- conan profile update settings.compiler.version=10 default
- conan profile update...