Compile and test a C application
Using Codefresh pipelines
Codefresh can work with any C/C++ application very easily as both gcc
and g++
are already offered in Dockerhub. There is also another example available with C++ and cmake.
The example C project
You can see the example project at https://github.com/codefresh-contrib/c-sample-app. The repository contains a C starter project with a Makefile
and several targets:
make
compiles the code.make test
runs unit testsmake clean
removes artifacts and binaries.
There are also extra targets for tags
and etags
.
Create a CI pipeline for C applications
Creating a CI/CD pipeline for C is very easy, because Codefresh can run any gcc image that you wish. Gcc docker images already contain the make
utility.
Here is the full pipeline that compiles the application after checking out the code.
codefresh.yml
This pipeline clones the source code, compiles the code and runs unit tests. In all cases we use the public Docker image of Gcc that also contains make
.
Related articles
C++ example
Codefresh YAML for pipeline definitions
Steps in pipelines
Creating pipelines
How Codefresh pipelines work