Using Jenkins with Eiffel
Using Jenkins is a great tool and we are using it at Eiffel Software to perform regression testing. The goal of this article is to show you how to verify that your Eiffel code always compile fine.
- Jenkins 1.551 or later
- EiffelStudio 14.05.9.4490 or later
First you need to create a new job item in Jenkins. For that you will choose to build multi-configuration project. Per the documentation, it is suitable for projects that need a large number of different configurations, such as testing on multiple environments, platform-specific builds, etc.
Under Configuration matrix we are going to define 2 user-defined axis:
- platform with value unix and windows
- source_path with the values of your choosing, it will be the locations where to find the source
Then you will add a build step "Execute Shell" with the following content:
echo "Creating a temporary directory where all the temporary files will be stored."
dir=`mktemp -d` && cd $dir
echo "To avoid any issue with precompiled libraries for various platforms, we set the path of the precompiled libraries."
$ISE_EIFFEL/tools/spec/$ISE_PLATFORM/bin/compile_all -l $source_path -compdir $dir -ecb -melt -clean -options dotnet=false,platform=$platform || failure=1
rm -rf $dir
if [ $failure -eq 1 ]; then
This shell script will execute compile_all, a tool of the EiffelStudio delivery, compiling all ECF files located under $source_path that are not made for .NET and compiling them for the chosen $platform.
Current the possible values for platform are:
When there is an ECF file that fails to compile, compile_all will return an error code which will mark the jenkins job as failed. When there is a failure we catch the failure, delete the temporary directory and report the failure to the shell. If we were not doing that, after a failure, it will stop executing the commands after compile_all and we would be left with many temporary directories.
The beauty of the multi-configuration project is that you can provide various source locations via source_path and it will basically compile them in parallel when you launch the job from the jenkins interface. Below is an example of the multi-configuration project we use at Eiffel Software, where each row corresponds to a particular source location and the column the platform for which it is compiled:
In this particular case, everything compiled except the configuration files under $EIFFEL_SRC/web. If your use the Matrix Reloaded extension, you can choose to just run the failed entries of the matrix after having fix the particular problem they raised by failing in the first place.
It is a very simple process and we can only recommend you to do the same.