diff --git a/.travis.yml b/.travis.yml index d0c962eb95e..fd6c417a2a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ +sudo: required language: c compiler: - gcc - clang +services: + - docker before_install: - - sudo apt-get update -qq - - sudo apt-get install -y gdebi-core - - sudo test/travis/build_deps.sh precise $TRAVIS_BUILD_DIR -script: ./test/travis/build_travis.sh + - docker pull linuxmaniac/pkg-kamailio-docker:jessie +script: docker run -v $TRAVIS_BUILD_DIR:/code:rw linuxmaniac/pkg-kamailio-docker:jessie /bin/bash -c "export CC=$CC; cd /code; ./test/travis/build_travis.sh" branches: only: - 'master' diff --git a/test/travis/README.md b/test/travis/README.md new file mode 100644 index 00000000000..a00dfe4d7c7 --- /dev/null +++ b/test/travis/README.md @@ -0,0 +1,62 @@ +Travis-ci build +=============== + +The build environment is based on docker containers, so it can be easily +reproducible by any developer of the project. + +The container we use is build at [docker hub](https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/) +It's Debian Stretch based image build [DockerFile](https://github.com/linuxmaniac/pkg-kamailio-docker/blob/master/stretch/Dockerfile) + +Build locally +------------- + +Same steps defined at [.travis.yml](https://github.com/kamailio/kamailio/blob/master/.travis.yml): + +- Choose the compiler you want to use setting `CC` to `gcc` or `clang` + +``` +$ docker pull linuxmaniac/pkg-kamailio-docker:jessie +$ docker run \ + -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:jessie \ + /bin/bash -c "export CC=gcc; cd /code; ./test/travis/build_travis.sh" +``` + +You can always [login](./README.md#login-inside-the-build-environment) inside the container +and build it [manually](http://www.kamailio.org/wiki/install/devel/git#compile_kamailio) + +Clean sources +------------- + +``` +$ docker run \ + -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:jessie \ + /bin/bash -c "cd /code; make -f debian/rules clean; rm -rf debian" +``` + +Login inside the build environment +---------------------------------- + +``` +$ docker run -i -t \ + -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:jessie /bin/bash +``` + +Test other Debian distributions +------------------------------- + +There are several container [images available](https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/tags/) already. +You just need to use any of the them selecting the proper tag + +``` +$ export $DIST=wheezy +$ docker pull linuxmaniac/pkg-kamailio-docker:$DIST +$ docker run \ + -v $(pwd):/code:rw linuxmaniac/pkg-kamailio-docker:$DIST \ + /bin/bash -c "export CC=$CC; cd /code; DIST=$DIST ./test/travis/build_travis.sh" +``` + + +TODO +---- + +- tests inside the docker container diff --git a/test/travis/build_travis.sh b/test/travis/build_travis.sh index 1fcd4c1bc6b..85b9fb218b5 100755 --- a/test/travis/build_travis.sh +++ b/test/travis/build_travis.sh @@ -1,25 +1,50 @@ #!/bin/bash # # build script for travis CI -# environment based on Ubuntu 12.04 LTS (precise) +# environment based docker container at +# https://hub.docker.com/r/linuxmaniac/pkg-kamailio-docker/ # set -e -export JAVA_HOME="/usr/lib/jvm/java-gcj" -EXCLUDED_MODULES="" -EXTRA_EXCLUDED_MODULES="bdb dbtext oracle pa iptrtpproxy mi_xmlrpc dnssec kazoo cnxcc" -PACKAGE_GROUPS="mysql postgres berkeley unixodbc radius presence ldap xml perl utils lua memcached \ - snmpstats carrierroute xmpp cpl redis python geoip\ - sqlite json mono ims sctp java \ - purple tls outbound websocket autheph" -echo "make cfg" -make FLAVOUR=kamailio cfg \ - skip_modules="${EXCLUDED_MODULES} ${EXTRA_EXCLUDED_MODULES}" \ - group_include="kstandard" -echo "make all" -make all -echo "make groups" -for grp in ${PACKAGE_GROUPS}; do - make every-module group_include="k${grp}" -done +DIST=${DIST:-jessie} +CC=${CC:-gcc} + +if ! [ -d /code/pkg/kamailio/deb/"${DIST}" ] ; then + echo "${DIST} not supported" + exit 1 +else + rm -rf /code/debian + ln -s /code/pkg/kamailio/deb/"${DIST}" /code/debian +fi +function build { + echo "make clean" + make -f debian/rules clean + echo "make build" + make -f debian/rules build +} + +if [[ "${CC}" =~ clang ]] ; then + CLANG=$(find /usr/bin -type l -name 'clang-[0-9]*' | sort -r | head -1) + echo "setting clang to ${CLANG}" + update-alternatives --install /usr/bin/clang clang "${CLANG}" 1 +fi + +echo "environment DIST=$DIST CC=$CC" +${CC} --version + +# build flags +export MEMDBG=0 +echo "build with MEMDBG=0" +build + +export MEMDBG=1 +echo "build with MEMDBG=1" +build + +if [[ "$CC" =~ gcc ]] ; then + echo "make install" + make install +else + echo "skip make install step" +fi