diff options
-rw-r--r-- | .gitlab-ci.yml | 31 | ||||
-rwxr-xr-x | tools/ci/jobs/gcc5.sh | 16 | ||||
-rwxr-xr-x | tools/ci/scripts/init.sh | 122 |
3 files changed, 169 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..13f759b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +stages: + - build + - success + - failure + +before_script: + - uname -a + +# simple builds + +gcc-5: + stage: build + script: + - ./tools/ci/jobs/gcc5.sh + image: debian:unstable + +# reports + +success: + stage: success + script: + - echo "do nothing" + image: debian:unstable + when: on_success + +failure: + stage: failure + script: + - echo "do nothing" + image: debian:unstable + when: on_failure diff --git a/tools/ci/jobs/gcc5.sh b/tools/ci/jobs/gcc5.sh new file mode 100755 index 0000000..d095016 --- /dev/null +++ b/tools/ci/jobs/gcc5.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export CC=gcc-5 +export CXX=g++-5 +export LOGFILE=gcc5.log + +source ./tools/ci/scripts/init.sh + +#aptget_install gcc-5 g++-5 \ +# make autoconf automake autopoint gettext libphysfs-dev \ +# libxml2-dev libcurl4-gnutls-dev libpng-dev \ +# libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev + +do_init +run_configure $* +run_make diff --git a/tools/ci/scripts/init.sh b/tools/ci/scripts/init.sh new file mode 100755 index 0000000..455673e --- /dev/null +++ b/tools/ci/scripts/init.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +pwd +mkdir logs + +export dir=$(pwd) +export ERRFILE=${dir}/logs/${LOGFILE} + +cat /etc/os-release + +rm ${ERRFILE} + +function do_init { + $CC --version + $CXX --version +} + +function aptget_update { + echo "apt-get update" + apt-get update + if [ "$?" != 0 ]; then + sleep 1s + apt-get update + if [ "$?" != 0 ]; then + sleep 2s + apt-get update + if [ "$?" != 0 ]; then + sleep 5s + apt-get update + fi + fi + fi +} + +function aptget_install { + echo "apt-get -y -qq install $*" + apt-get -y -qq install $* + if [ "$?" != 0 ]; then + sleep 1s + apt-get -y -qq install $* + if [ "$?" != 0 ]; then + sleep 2s + if [ "$?" != 0 ]; then + sleep 5s + apt-get -y -qq install $* + fi + apt-get -y -qq install $* + fi + fi +} + +function check_error { + if [ "$1" != 0 ]; then + echo "error $1" + exit $result + fi +} + +function run_configure_simple { + echo "autoreconf -i" + autoreconf -i + check_error $? + mkdir build + cd build + echo "../configure $*" + ../configure $* + check_error $? +} + +function run_configure { + run_configure_simple $* +} + +function run_make { + echo "make -j2 V=0 $*" + make -j2 V=0 $* + check_error $? +} + +function run_check_warnings { + DATA=$(cat $ERRFILE) + if [ "$DATA" != "" ]; + then + cat $ERRFILE + exit 1 + fi +} + +function run_h { + rm $ERRFILE + echo "$CC -c -x c++ $* $includes */*/*/*.h */*/*.h */*.h *.h" + $CC -c -x c++ $* $includes */*/*/*.h */*/*.h */*.h *.h 2>$ERRFILE + DATA=$(cat $ERRFILE) + if [ "$DATA" != "" ]; + then + cat $ERRFILE + exit 1 + fi +} + +function run_tarball { + rm $ERRFILE + echo "make dist-xz" + make dist-xz 2>$ERRFILE + check_error $? + + mkdir $1 + cd $1 + echo "tar xf ../*.tar.xz" + tar xf ../*.tar.xz + cd manaplus* +} + +function run_mplint { + rm $ERRFILE + echo "mplint/src/mplint $*" + mplint/src/mplint $* >$ERRFILE + check_error $? + run_check_warnings +} + +aptget_update |