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 @@
0
+Travis-ci build
1
+===============
2
+
3
+The build environment is based on docker containers, so it can be easily
4
+reproducible by any developer of the project.
5
+
6
+The container we use is build at [docker hub](https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/)
7
+It's Debian Stretch based image build [DockerFile](https://github.com/linuxmaniac/pkg-kamailio-docker/blob/master/stretch/Dockerfile)
8
+
9
+Build locally
10
+-------------
11
+
12
+Same steps defined at [.travis.yml](https://github.com/kamailio/kamailio/blob/master/.travis.yml):
13
+
14
+- Choose the compiler you want to use setting `CC` to `gcc` or `clang`
15
+
16
+```
17
+$ docker pull linuxmaniac/pkg-kamailio-docker:stretch
18
+$ docker run \
19
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:stretch \
20
+    /bin/bash -c "export CC=gcc; cd /code; ./test/travis/build_travis.sh"
21
+```
22
+
23
+You can always [login](./README.md#login-inside-the-build-environment) inside the container
24
+and build it [manually](http://www.kamailio.org/wiki/install/devel/git#compile_kamailio)
25
+
26
+Clean sources
27
+-------------
28
+
29
+```
30
+$ docker run \
31
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:stretch \
32
+    /bin/bash -c "cd /code; make -f debian/rules clean; rm -rf debian"
33
+```
34
+
35
+Login inside the build environment
36
+----------------------------------
37
+
38
+```
39
+$ docker run -i -t \
40
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:stretch /bin/bash
41
+```
42
+
43
+Test other Debian distributions
44
+-------------------------------
45
+
46
+There are several container [images available](https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/tags/) already.
47
+You just need to use any of the them selecting the proper tag
48
+
49
+```
50
+$ export $DIST=sid
51
+$ docker pull linuxmaniac/pkg-kamailio-docker:$DIST
52
+$ docker run \
53
+    -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:$DIST \
54
+    /bin/bash -c "export CC=$CC; cd /code; DIST=$DIST ./test/travis/build_travis.sh"
55
+```
56
+
57
+
58
+TODO
59
+----
60
+
61
+- 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 53
 
54 54
 if [[ "$CC" =~ gcc ]] ; then
55 55
 	echo "make install"
56
-	sudo make install
56
+	make install
57 57
 else
58 58
 	echo "skip make install step"
59 59
 fi