Gold Rule #1 in devops
The steps should work in your localhost preferable on Linux and using the shell, before port it to Jenkins. If it don't work even on your localhost, Jenkins can't do anything.
Then if it works in your localhost (all the shells and installed tools required) , in jenkins you could use on of these approaches:
- Jenkins shell script
- Some Jenkins plugin to avoid the shell or scripts
Gold Rule #2 in devops
Use the shell, not programs with user interface , sometimes called IDEs. Devops flows for build, test, deploy are executed in the background and the 99.999% on Linux, not windows
c++ build
Reviewing, cmkake is used to build c++ applications. Also some others tools:
More details here: How to compile a c++ program in Linux?
Here a sample with g++
# compile
g++ ./foo/bar.cpp -o ./foo/bar
# this will generate an executable file ./foo/bar ready to be used
Since you have several files, you only need to append the files to the g++ according to:
https://stackoverflow.com/a/30064940/3957754
unit test
Depending of the classification (compiled/interpreted), execute a unit test is just to run a file:
java
Searches all *Test.java files and if the files has the @Test annotation, the file is executed
nodejs
- node /foo/bar/test.js
- jest ...
- mocha 'src/test/**/*.test.js'
Similar to java but with *.test.js files
As you can see, unit test is just to execute a file some times compiled previously or directly execution. So in your case, since c++ is a compiled language, to run your test , you only need
# compile
g++ ./UnitTest/UnitTest.cpp -o ./UnitTest/UnitTest
# run
./UnitTest/UnitTest
Visual Studio
This tool is for c#. If you read the previous paragraphs, you don't need complicated tools to build c++ projects.
Windows
You only need to choose one tool, install it on your windows, open the CMD shell or powershell and try the commands
If it works, go to your jenkins and use the shell step
References