Add Travis-CI integration for Xonotic.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 27 Aug 2014 12:46:22 +0000 (12:46 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 27 Aug 2014 12:46:22 +0000 (12:46 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12091 d7cf8633-e32d-0410-b094-e92efae38249

.travis-before_install-xonotic.sh [new file with mode: 0755]
.travis-id_rsa-xonotic [new file with mode: 0644]
.travis-script-xonotic.sh [new file with mode: 0755]
.travis.yml [new file with mode: 0644]

diff --git a/.travis-before_install-xonotic.sh b/.travis-before_install-xonotic.sh
new file mode 100755 (executable)
index 0000000..adb87e9
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+set -ex
+
+if [ "`uname`" = 'Linux' ]; then
+  sudo apt-get update -qq
+fi
+
+for os in "$@"; do
+  case "$os" in
+    linux32)
+      # Prepare an i386 chroot. This is required as we otherwise can't install
+      # our dependencies to be able to compile a 32bit binary. Ubuntu...
+      chroot="$PWD"/buildroot.i386
+      mkdir -p "$chroot$PWD"
+      sudo apt-get install -y debootstrap
+      sudo i386 debootstrap --arch=i386 precise "$chroot"
+      sudo mount --rbind "$PWD" "$chroot$PWD"
+      sudo i386 chroot "$chroot" apt-get install -y \
+        build-essential
+      # Now install our dependencies.
+      sudo i386 chroot "$chroot" apt-get install -y \
+        libxpm-dev libsdl1.2-dev libxxf86vm-dev
+      wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
+      tar xf SDL2-2.0.3.tar.gz
+      (
+      cd SDL2-2.0.3
+      sudo i386 chroot "$chroot" sh -c "cd $PWD && ./configure --enable-static --disable-shared"
+      sudo i386 chroot "$chroot" make -C "$PWD"
+      sudo i386 chroot "$chroot" make -C "$PWD" install
+      )
+      ;;
+    linux64)
+      sudo apt-get install -y \
+        libxpm-dev libsdl1.2-dev libxxf86vm-dev
+      wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
+      tar xf SDL2-2.0.3.tar.gz
+      (
+      cd SDL2-2.0.3
+      ./configure --enable-static --disable-shared
+      make
+      sudo make install
+      )
+      ;;
+    win32)
+      sudo apt-get install -y \
+        mingw-w64 mingw32- mingw32-binutils-
+      ;;
+    win64)
+      sudo apt-get install -y \
+        mingw-w64 mingw32- mingw32-binutils-
+      ;;
+    osx)
+      git archive --format=tar --remote=git://de.git.xonotic.org/xonotic/xonotic.git \
+        --prefix=SDL.framework/ master:misc/buildfiles/osx/Xonotic.app/Contents/Frameworks/SDL.framework | tar xvf -
+      ;;
+  esac
+done
+
+git archive --format=tar --remote=git://de.git.xonotic.org/xonotic/xonotic.git \
+  --prefix=.deps/ master:misc/builddeps | tar xvf -
+for X in .deps/*; do
+  rsync --remove-source-files -aL "$X"/*/ "$X"/ || true
+done
diff --git a/.travis-id_rsa-xonotic b/.travis-id_rsa-xonotic
new file mode 100644 (file)
index 0000000..c8446b5
Binary files /dev/null and b/.travis-id_rsa-xonotic differ
diff --git a/.travis-script-xonotic.sh b/.travis-script-xonotic.sh
new file mode 100755 (executable)
index 0000000..a8a19b9
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+set -ex
+
+openssl aes-256-cbc \
+  -K $encrypted_08aaf016324d_key -iv $encrypted_08aaf016324d_iv \
+  -in .travis-id_rsa-xonotic -out id_rsa-xonotic -d
+chmod 0600 id_rsa-xonotic
+ssh-keygen -y -f id_rsa-xonotic
+
+rev=`git rev-parse HEAD`
+
+sftp -oStrictHostKeyChecking=no -i id_rsa-xonotic -P 2222 -b - autobuild-bin-uploader@beta.xonotic.org <<EOF || true
+mkdir ${rev}
+EOF
+
+for os in "$@"; do
+
+  deps=".deps/${os}"
+  case "${os}" in
+    linux32)
+      chroot="sudo chroot ${PWD}/buildroot.i386"
+      makeflags='STRIP=: CC="${CC} -m32 -march=i686 -g1 -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6" SDL_CONFIG=sdl2-config LIB_JPEG=../../../${deps}/lib/libjpeg.a LIB_CRYPTO="../../../${deps}/lib/libd0_blind_id.a ../../../${deps}/lib/libgmp.a" DP_LINK_ZLIB=shared DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=shared DP_LINK_CRYPTO_RIJNDAEL=dlopen'
+      maketargets='release'
+      outputs='darkplaces-glx:xonotic-linux32-glx darkplaces-sdl:xonotic-linux32-sdl darkplaces-dedicated:xonotic-linux32-dedicated'
+      ;;
+    linux64)
+      chroot=
+      makeflags='STRIP=: CC="${CC} -m64 -g1 -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6" SDL_CONFIG=sdl2-config LIB_JPEG=../../../${deps}/lib/libjpeg.a LIB_CRYPTO="../../../${deps}/lib/libd0_blind_id.a ../../../${deps}/lib/libgmp.a" DP_LINK_ZLIB=shared DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=shared DP_LINK_CRYPTO_RIJNDAEL=dlopen'
+      maketargets='release'
+      outputs='darkplaces-glx:xonotic-linux64-glx darkplaces-sdl:xonotic-linux64-sdl darkplaces-dedicated:xonotic-linux64-dedicated'
+      ;;
+    win32)
+      chroot=
+      makeflags='STRIP=: DP_MAKE_TARGET=mingw UNAME=MINGW32 CC="i686-w64-mingw32-gcc -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../${deps}/include -L../../../${deps}/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i686-w64-mingw32-windres" SDL_CONFIG="../../../${deps}/bin/sdl2-config" DP_LINK_ZLIB=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen WIN32RELEASE=1 D3D=1'
+      maketargets='release'
+      outputs='darkplaces.exe:xonotic.exe darkplaces-sdl.exe:xonotic-sdl.exe darkplaces-dedicated.exe:xonotic-dedicated.exe'
+      ;;
+    win64)
+      chroot=
+      makeflags='STRIP=: DP_MAKE_TARGET=mingw UNAME=MINGW32 CC="x86_64-w64-mingw32-gcc -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../${deps}/include -L../../../${deps}/lib -DSUPPORTIPV6" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG="../../../${deps}/bin/sdl2-config" DP_LINK_ZLIB=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen WIN64RELEASE=1 D3D=1'
+      maketargets='release'
+      outputs='darkplaces.exe:xonotic-x64.exe darkplaces-sdl.exe:xonotic-x64-sdl.exe darkplaces-dedicated.exe:xonotic-x64-dedicated.exe'
+      ;;
+    osx)
+      chroot=
+      makeflags='STRIP=: CC="gcc -g1 -arch x86_64 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.5 -I../../../${deps}/include -L../../../${deps}/lib -I${PWD}/SDL.framework/Headers -F${PWD} -DSUPPORTIPV6" DP_LINK_ZLIB=shared DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen'
+      maketargets='sv-release sdl-release'
+      outputs='darkplaces-sdl:xonotic-osx-sdl-bin darkplaces-dedicated:xonotic-osx-dedicated'
+      ;;
+  esac
+
+  (
+  trap "${chroot} make -C ${PWD} ${makeflags} clean" EXIT
+  eval "${chroot} make -C ${PWD} ${makeflags} ${maketargets}"
+  for o in $outputs; do
+    src=${o%%:*}
+    dst=${o#*:}
+    sftp -oStrictHostKeyChecking=no -i id_rsa-xonotic -P 2222 -b - autobuild-bin-uploader@beta.xonotic.org <<EOF
+put ${src} ${rev}/${dst}
+EOF
+  done
+  )
+
+done
diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..e6dfe43
--- /dev/null
@@ -0,0 +1,32 @@
+language: cpp
+matrix:
+  include:
+  - os: linux
+    env: PROJECT=xonotic OS="linux32"
+    compiler: gcc
+  - os: linux
+    env: PROJECT=xonotic OS="linux64"
+    compiler: gcc
+  - os: linux
+    env: PROJECT=xonotic OS="win32"
+    compiler: gcc
+  - os: linux
+    env: PROJECT=xonotic OS="win64"
+    compiler: gcc
+  - os: osx
+    env: PROJECT=xonotic OS="osx"
+    compiler: gcc
+before_install:
+- "./.travis-before_install-${PROJECT}.sh $OS"
+install:
+- true
+before_script:
+- true
+script:
+- "./.travis-script-${PROJECT}.sh $OS"
+after_success:
+- true
+after_failure:
+- true
+after_script:
+- true