Browse code

test/travis: support different debian distributions

- add some documentation
- add link to travis doc at /README.md
- add travis build status at /README.md
- use ${DIST}/rules to control the build
this simplifies the supported modules list by ${DIST}
it is already defined there. K.I.S.S
- install is done at debian/kamailio dir

Victor Seva authored on 24/11/2015 12:52:30
Showing 3 changed files
... ...
@@ -1,4 +1,4 @@
1
-# Kamailio - The Open Source SIP Server
1
+# Kamailio - The Open Source SIP Server [![Build Status](https://travis-ci.org/kamailio/kamailio.svg?branch=master)](https://travis-ci.org/kamailio/kamailio)
2 2
 
3 3
 Project Website:
4 4
 
... ...
@@ -108,4 +108,9 @@ News:
108 108
 
109 109
   * http://www.kamailio.org/w/category/news/
110 110
 
111
+## Travis-ci/Testing build environment
112
+
113
+ * [travis-ci](https://travis-ci.org/kamailio/kamailio/builds/)
114
+ * [docker build](/test/travis/README.md)
115
+
111 116
 **Thank you for flying Kamailio!**
112 117
new file mode 100644
... ...
@@ -0,0 +1,62 @@
1
+Travis-ci build
2
+===============
3
+
4
+The build environment is based on docker containers, so it can be easily
5
+reproducible by any developer of the project.
6
+
7
+The container we use is build at [docker hub](https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/)
8
+It's Debian Stretch based image build [DockerFile](https://github.com/linuxmaniac/pkg-kamailio-docker/blob/master/stretch/Dockerfile)
9
+
10
+Build locally
11
+-------------
12
+
13
+Same steps defined at [.travis.yml](https://github.com/kamailio/kamailio/blob/master/.travis.yml):
14
+
15
+- Choose the compiler you want to use setting `CC` to `gcc` or `clang`
16
+
17
+```
18
+$ docker pull linuxmaniac/pkg-kamailio-docker:stretch
19
+$ docker run \
20
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:stretch \
21
+    /bin/bash -c "export CC=gcc; cd /code; ./test/travis/build_travis.sh"
22
+```
23
+
24
+You can always [login](./README.md#login-inside-the-build-environment) inside the container
25
+and build it [manually](http://www.kamailio.org/wiki/install/devel/git#compile_kamailio)
26
+
27
+Clean sources
28
+-------------
29
+
30
+```
31
+$ docker run \
32
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:stretch \
33
+    /bin/bash -c "cd /code; make -f debian/rules clean; rm -rf debian"
34
+```
35
+
36
+Login inside the build environment
37
+----------------------------------
38
+
39
+```
40
+$ docker run -i -t \
41
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:stretch /bin/bash
42
+```
43
+
44
+Test other Debian distributions
45
+-------------------------------
46
+
47
+There are several container [images available](https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/tags/) already.
48
+You just need to use any of the them selecting the proper tag
49
+
50
+```
51
+$ export $DIST=sid
52
+$ docker pull linuxmaniac/pkg-kamailio-docker:$DIST
53
+$ docker run \
54
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:$DIST \
55
+    /bin/bash -c "export CC=$CC; cd /code; DIST=$DIST ./test/travis/build_travis.sh"
56
+```
57
+
58
+
59
+TODO
60
+----
61
+
62
+- tests inside the docker container
... ...
@@ -1,46 +1,37 @@
1 1
 #!/bin/bash
2 2
 #
3 3
 # build script for travis CI
4
-# environment based on Debian Stretch
4
+# environment based docker container at
5
+# https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/
5 6
 #
6 7
 
7 8
 set -e
8 9
 
9
-# choose freeradius
10
-export FREERADIUS=1
11
-
12
-export JAVA_HOME="/usr/lib/jvm/java-gcj"
13
-EXCLUDED_MODULES=""
14
-EXTRA_EXCLUDED_MODULES="bdb dbtext oracle pa iptrtpproxy mi_xmlrpc"
15
-PACKAGE_GROUPS="mysql postgres berkeley unixodbc radius presence ldap xml perl utils lua memcached \
16
-	snmpstats carrierroute xmpp cpl redis python geoip\
17
-	sqlite json mono ims sctp java \
18
-	purple tls outbound websocket autheph \
19
-	dnssec kazoo cnxcc erlang"
10
+DIST=${DIST:-stretch}
11
+CC=${CC:-gcc}
20 12
 
13
+if ! [ -d /code/pkg/kamailio/deb/"${DIST}" ] ; then
14
+	echo "${DIST} not supported"
15
+	exit 1
16
+else
17
+	rm -rf /code/debian
18
+	ln -s /code/pkg/kamailio/deb/"${DIST}" /code/debian
19
+fi
21 20
 function build {
22
-	echo "make distclean"
23
-	make distclean
24
-	echo "make cfg"
25
-	make FLAVOUR=kamailio cfg \
26
-		skip_modules="${EXCLUDED_MODULES} ${EXTRA_EXCLUDED_MODULES}" \
27
-		group_include="kstandard"
28
-	echo "make all"
29
-	make all
30
-	echo "make groups"
31
-	for grp in ${PACKAGE_GROUPS}; do
32
-		make every-module group_include="k${grp}"
33
-	done
21
+	echo "make clean"
22
+	make -f debian/rules clean
23
+	echo "make build"
24
+	make -f debian/rules build
34 25
 }
35 26
 
36
-if [[ "$CC" =~ clang ]] ; then
27
+if [[ "${CC}" =~ clang ]] ; then
37 28
 	CLANG=$(find /usr/bin -type l -name 'clang-[0-9]*' | sort -r | head -1)
38 29
 	echo "setting clang to ${CLANG}"
39
-	update-alternatives --install /usr/bin/clang clang $CLANG 1
30
+	update-alternatives --install /usr/bin/clang clang "${CLANG}" 1
40 31
 fi
41 32
 
42
-echo "CC=$CC"
43
-echo "$($CC --version)"
33
+echo "environment DIST=$DIST CC=$CC"
34
+${CC} --version
44 35
 
45 36
 # build flags
46 37
 export MEMDBG=0
... ...
@@ -53,7 +44,7 @@ build
53 44
 
54 45
 if [[ "$CC" =~ gcc ]] ; then
55 46
 	echo "make install"
56
-	sudo make install
47
+	make install
57 48
 else
58 49
 	echo "skip make install step"
59 50
 fi