Browse Source

For Travis CI - code cleanup but add more memory diagnostics.
[ci package]

- Simplify the check on environment variable containing the commit-ish used in the 'git describe' command.
- Shuffle the rebase order in 'ci_rebase' rake task, move the OSX-CI rebase to the last as OSX Travis-CI build environment is extremely slow lately (has longer job queue).
- Improve 'android' rake task to only create named AVD for CI test when necessary and to turn off graphics acceleration explicitly when starting the emulator in CI environment.
- Add more memory diagnostics to help in investigation of process being killed by Travis CI upstream issue reported in #430.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
036fe0959c
3 changed files with 12 additions and 7 deletions
  1. 2 0
      .travis.yml
  2. 6 3
      Rakefile
  3. 4 4
      Source/CMake/Modules/GetUrho3DRevision.cmake

+ 2 - 0
.travis.yml

@@ -40,6 +40,7 @@ matrix:
 language: cpp
 compiler: gcc
 before_install:
+  - free -tm
   - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then export SITE_UPDATE_ON_MASTER_COMMIT=$SITE_UPDATE; export RELEASE_TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT); if [ $RELEASE_TAG ] || echo $COMMIT_MESSAGE |grep -cq '\[ci package\]'; then export PACKAGE_UPLOAD=1; fi; fi
   - if [ "$SITE_UPDATE_ON_MASTER_COMMIT" -o "$PACKAGE_UPLOAD" ]; then travis_retry sudo add-apt-repository ppa:george-edison55/precise-backports -y; fi
   - travis_retry sudo apt-get update -q -y
@@ -50,6 +51,7 @@ install:
   - if [ $WINDOWS ]; then travis_retry sudo apt-get install -q -y gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 binutils-mingw-w64 binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 && export MINGW_PREFIX=/usr/bin/${ARCH}-w64-mingw32; fi
   - if [ $PACKAGE_UPLOAD ] && [ "$LINUX" -o "$RPI" ]; then travis_retry sudo apt-get install -q -y rpm; fi
   - if [ "$LINUX" -a "$URHO3D_64BIT" ]; then bash -e /etc/init.d/xvfb start; fi
+  - free -tm
 script: rake ci
 after_success:
   - if [ $SITE_UPDATE_ON_MASTER_COMMIT ]; then rake ci_site_update && rake ci_rebase; fi

+ 6 - 3
Rakefile

@@ -127,9 +127,9 @@ end
 # Usage: NOT intended to be used manually (if you insist then try: GIT_NAME=... GIT_EMAIL=... GH_TOKEN=... rake ci_rebase)
 desc 'Rebase Android-CI and OSX-CI mirror branches'
 task :ci_rebase do
-  system 'sleep 10 && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git && git fetch origin OSX-CI:OSX-CI && git rebase origin/master OSX-CI && git push -qf -u origin OSX-CI >/dev/null 2>&1' or abort 'Failed to rebase OSX-CI mirror branch'
   system 'sleep 10 && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git && git fetch origin Android-CI:Android-CI && git rebase origin/master Android-CI && git push -qf -u origin Android-CI >/dev/null 2>&1' or abort 'Failed to rebase Android-CI mirror branch'
   system 'sleep 10 && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git && git fetch origin RPI-CI:RPI-CI && git rebase origin/master RPI-CI && git push -qf -u origin RPI-CI >/dev/null 2>&1' or abort 'Failed to rebase RPI-CI mirror branch'
+  system 'sleep 10 && git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git && git fetch origin OSX-CI:OSX-CI && git rebase origin/master OSX-CI && git push -qf -u origin OSX-CI >/dev/null 2>&1' or abort 'Failed to rebase OSX-CI mirror branch'
 end
 
 # Usage: NOT intended to be used manually (if you insist then try: rake ci_package_upload)
@@ -325,8 +325,11 @@ end
 def android_prepare_device api, name = 'test'
   system 'if ! ps |grep -cq adb; then adb start-server; fi'
   if `adb devices |tail -n +2 |head -1`.chomp.empty?
-    # Don't have any attached then force create a new virtual one and start it
-    system "if [ $CI ]; then export OPTS='-no-skin -no-audio -no-window -no-boot-anim'; else export OPTS='-gpu on'; fi && echo 'no' |android create avd --force -n #{name} -t android-#{api} && emulator -avd #{name} $OPTS &"
+    # Don't have any (virtual) device attached, try to attach the named device (create the named device as AVD if necessary)
+    if !system "android list avd |grep -cq 'Name: #{name}$'"
+      system "echo 'no' |android create avd -n #{name} -t android-#{api}" or abort "Failed to create '#{name}' Android virtual device"
+    end
+    system "if [ $CI ]; then export OPTS='-no-skin -no-audio -no-window -no-boot-anim -gpu off'; else export OPTS='-gpu on'; fi; emulator -avd #{name} $OPTS &"
   else
     # Otherwise, try to unlock it just in case it is locked
     system "adb shell 'input keyevent 82; input keyevent 4'"

+ 4 - 4
Source/CMake/Modules/GetUrho3DRevision.cmake

@@ -22,13 +22,13 @@
 
 # Get Urho3D library revision number
 
-if ($ENV{CI})
+if (DEFINED ENV{TRAVIS_COMMIT})
     # Use the same commit-ish used by CI server to describe the repository
-    set (OPT $ENV{TRAVIS_COMMIT})
+    set (ARG $ENV{TRAVIS_COMMIT})
 else ()
-    set (OPT --dirty)
+    set (ARG --dirty)
 endif ()
-execute_process (COMMAND git describe ${OPT} RESULT_VARIABLE GIT_EXIT_CODE OUTPUT_VARIABLE LIB_REVISION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process (COMMAND git describe ${ARG} RESULT_VARIABLE GIT_EXIT_CODE OUTPUT_VARIABLE LIB_REVISION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
 if (NOT GIT_EXIT_CODE EQUAL 0)
     # No GIT command line tool or not a GIT repository
     set (LIB_REVISION Unversioned)