Difference between revisions of "Jenkins"

From Lazarus wiki
(Started; need to tidy up/finish)
 
(First notes: getting FPC compiled)
Line 2: Line 2:
 
Jenkins is a continuous integration server that can be used to automatically build and test projects based on commits to your source control system.
 
Jenkins is a continuous integration server that can be used to automatically build and test projects based on commits to your source control system.
  
== Use with FPC ==
+
== Use with FPC/Lazarus ==
Notes for FPC/Laz: to do: fix
+
This section describes how to set up Jenkins to automatically build FPC when a commit happens in SVN.
Jenkins set up
 
Turnkey Linux Jenkins on Debian 6.0.5 (Squeeze)
 
SVN plugin enabled
 
  
 +
=== Jenkins set up===
 +
A possible version to use is Turnkey Linux Jenkins on Debian 6.0.5 (Squeeze)
 +
In any case, make sure the SVN plugin is enabled
 +
 +
<syntaxhighlight lang="bash">
 
install binutils+stable FPC:
 
install binutils+stable FPC:
 
apt-get instal build-essential
 
apt-get instal build-essential
Line 33: Line 35:
 
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils_2.6.0-0_i386.deb/download
 
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils_2.6.0-0_i386.deb/download
 
mv download fp-utils_2.6.0-0_i386.deb
 
mv download fp-utils_2.6.0-0_i386.deb
 
  
 
dpkg -i fp-units-rtl-2.6.0_2.6.0-0_i386.deb
 
dpkg -i fp-units-rtl-2.6.0_2.6.0-0_i386.deb
Line 40: Line 41:
 
dpkg -i fp-utils-2.6.0_2.6.0-0_i386.deb
 
dpkg -i fp-utils-2.6.0_2.6.0-0_i386.deb
 
#no idea what the other .debs are for that we downloaded
 
#no idea what the other .debs are for that we downloaded
 +
#todo: this could be trimmed down a bit, but this seems to work
 +
</syntaxhighlight>
 +
 +
=== Setting up jobs ===
 +
Use the job screen to set the svn source to the FPC trunk or branch you want to use (e.g. http://svn.freepascal.org/svn/fpc/branches/fixes_2_6)
 +
 +
Set 'use svn update as much as possible'
 +
 +
Polling every 5 minutes could be a good setup. Alternatively, you can set up your own SVN server and write a commit hook script for that. This would result in this entry:
 +
<syntaxhighlight lang="bash">
 +
# every 5 minutes
 +
*/5 * * * *
 +
</syntaxhighlight>
  
Set up jobs
+
As build commands, the shell commnds
 +
<syntaxhighlight lang="bash">
 +
make all
 +
</syntaxhighlight>
 +
and, to install inside the "workspace" or top of the build directory environment:
 +
<syntaxhighlight lang="bash">
 +
make install PREFIX=$WORKSPACE
 +
</syntaxhighlight>
 +
Note: installing somewhere else may be a good idea, please refer to the Build FAQ.
  
---todo=>make clean?
+
=== Enhancements ===
compiler test suite
+
Possible enhancements:
build slaves
+
* run make clean before building
 +
* run make install into a different prefix
 +
* run Lazarus compile
 +
* run compiler test suite, save results
 +
* run dbtestframework test suite, save results (in database or via XML if Jenkins supports that)
 +
* add Windows (etc) build slaves
 +
* add installer builders
 +
* different repositories

Revision as of 14:54, 6 October 2012

Overview

Jenkins is a continuous integration server that can be used to automatically build and test projects based on commits to your source control system.

Use with FPC/Lazarus

This section describes how to set up Jenkins to automatically build FPC when a commit happens in SVN.

Jenkins set up

A possible version to use is Turnkey Linux Jenkins on Debian 6.0.5 (Squeeze) In any case, make sure the SVN plugin is enabled

install binutils+stable FPC:
apt-get instal build-essential
#fpc would get 2.4 => symptom: 
#generic.inc(2505,13) Fatal: Internal error 8
#Fatal: Compilation aborted
#make[7]: *** [system.ppu] Error 1

#get stable compiler (2.6 at time of writing); we're on a 32 bit system:
cd /root
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-compiler-2.6.0_2.6.0-0_i386.deb/download
mv download fp-compiler-2.6.0_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-compiler_2.6.0-0_i386.deb/download
mv download fp-compiler_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-rtl_2.6.0-0_i386.deb/download
mv download fp-units-rtl_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-rtl-2.6.0_2.6.0-0_i386.deb/download
mv download fp-units-rtl-2.6.0_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-i386-2.6.0_2.6.0-0_i386.deb/download
mv download fp-units-i386-2.6.0_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-i386_2.6.0-0_i386.deb/download
mv download fp-units-i386_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils-2.6.0_2.6.0-0_i386.deb/download
mv download fp-utils-2.6.0_2.6.0-0_i386.deb
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils_2.6.0-0_i386.deb/download
mv download fp-utils_2.6.0-0_i386.deb

dpkg -i fp-units-rtl-2.6.0_2.6.0-0_i386.deb
dpkg -i fp-units-rtl_2.6.0-0_i386.deb
dpkg -i fp-compiler-2.6.0_2.6.0-0_i386.deb
dpkg -i fp-utils-2.6.0_2.6.0-0_i386.deb
#no idea what the other .debs are for that we downloaded
#todo: this could be trimmed down a bit, but this seems to work

Setting up jobs

Use the job screen to set the svn source to the FPC trunk or branch you want to use (e.g. http://svn.freepascal.org/svn/fpc/branches/fixes_2_6)

Set 'use svn update as much as possible'

Polling every 5 minutes could be a good setup. Alternatively, you can set up your own SVN server and write a commit hook script for that. This would result in this entry:

# every 5 minutes
*/5 * * * *

As build commands, the shell commnds

make all

and, to install inside the "workspace" or top of the build directory environment:

make install PREFIX=$WORKSPACE

Note: installing somewhere else may be a good idea, please refer to the Build FAQ.

Enhancements

Possible enhancements:

  • run make clean before building
  • run make install into a different prefix
  • run Lazarus compile
  • run compiler test suite, save results
  • run dbtestframework test suite, save results (in database or via XML if Jenkins supports that)
  • add Windows (etc) build slaves
  • add installer builders
  • different repositories