Browse Source

For Travis CI - more granular timeup check to avoid timeout error.
[ci only: OSX] [skip appveyor]

Yao Wei Tjong 姚伟忠 9 years ago
parent
commit
01b86ba68a
3 changed files with 23 additions and 7 deletions
  1. 5 1
      CMake/Modules/Urho3D-CMake-common.cmake
  2. 1 1
      Docs/GettingStarted.dox
  3. 17 5
      Rakefile

+ 5 - 1
CMake/Modules/Urho3D-CMake-common.cmake

@@ -335,7 +335,7 @@ endif ()
 
 
 # Enable/disable SIMD instruction set for STB image (do it here instead of in the STB CMakeLists.txt because the header files are exposed to Urho3D library user)
 # Enable/disable SIMD instruction set for STB image (do it here instead of in the STB CMakeLists.txt because the header files are exposed to Urho3D library user)
 if (NEON AND NOT XCODE)
 if (NEON AND NOT XCODE)
-    add_definitions (-DSTBI_NEON)       # Cannot define it directory for Xcode due to universal binary support, we define it in the setup_target() macro instead for Xcode
+    add_definitions (-DSTBI_NEON)       # Cannot define it directly for Xcode due to universal binary support, we define it in the setup_target() macro instead for Xcode
 elseif (NOT URHO3D_SSE)
 elseif (NOT URHO3D_SSE)
     add_definitions (-DSTBI_NO_SIMD)    # GCC/Clang/MinGW will switch this off automatically except MSVC, but no harm to make it explicit for all
     add_definitions (-DSTBI_NO_SIMD)    # GCC/Clang/MinGW will switch this off automatically except MSVC, but no harm to make it explicit for all
 endif ()
 endif ()
@@ -1033,6 +1033,10 @@ macro (setup_target)
             COMMAND mkdir -p ${DIRECTORY} && ln -sf $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
             COMMAND mkdir -p ${DIRECTORY} && ln -sf $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
             WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
             WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
     endif ()
     endif ()
+    # Workaround to avoid technical error due to Travis CI build time limit
+    if (DEFINED ENV{TRAVIS})
+        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND rake ci_timeup WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+    endif ()
 endmacro ()
 endmacro ()
 
 
 # Macro for checking the SOURCE_FILES variable is properly initialized
 # Macro for checking the SOURCE_FILES variable is properly initialized

+ 1 - 1
Docs/GettingStarted.dox

@@ -58,7 +58,7 @@ To run Urho3D, the minimum system requirements are:
 
 
 SSE2 requirement can be eliminated by disabling the use of SSE2 instruction set, see URHO3D_SSE build option below. For Linux platform using GCC/Clang compiler toolchain, the MMX and 3DNow! extensions can be enabled for older CPUs by using URHO3D_MMX and URHO3D_3DNOW build options when the option is available. The MMX and SSE/SSE2 extensions on x86_64 ABI are always enabled, so the URHO3D_MMX and URHO3D_SSE build option do not exist on x86_64 ABI. Also note that MMX extension is effectively enabled when 3DNow! or SSE/SSE2 extension is enabled, so disabling URHO3D_MMX build option in this case has no effect. The URHO3D_MMX and URHO3D_3DNOW build options are disabled by default. They should only be enabled when targeting older CPU with MMX and 3DNow! support, respectively.
 SSE2 requirement can be eliminated by disabling the use of SSE2 instruction set, see URHO3D_SSE build option below. For Linux platform using GCC/Clang compiler toolchain, the MMX and 3DNow! extensions can be enabled for older CPUs by using URHO3D_MMX and URHO3D_3DNOW build options when the option is available. The MMX and SSE/SSE2 extensions on x86_64 ABI are always enabled, so the URHO3D_MMX and URHO3D_SSE build option do not exist on x86_64 ABI. Also note that MMX extension is effectively enabled when 3DNow! or SSE/SSE2 extension is enabled, so disabling URHO3D_MMX build option in this case has no effect. The URHO3D_MMX and URHO3D_3DNOW build options are disabled by default. They should only be enabled when targeting older CPU with MMX and 3DNow! support, respectively.
 
 
-The NEON instruction set will be used by default whenever it is available. See the ANDROID_ABI and RPI_ABI build options for more detail for Android and Raspberry-Pi platforms, respectively. The NEON instruction set is always enabled on iOS and tVOS platforms.
+The NEON instruction set will be used by default whenever it is available. See the ANDROID_ABI and RPI_ABI build options for more detail for Android and Raspberry-Pi platforms, respectively. The NEON instruction set is always used on iOS and tVOS platforms.
 
 
 CMake (http://www.cmake.org) is required to configure and generate the Urho3D project build tree. The minimum required version is 2.8.6. However, it is recommended to use the latest CMake version available out there, especially when targeting Mac OS X and iOS platforms using the latest Xcode version available. This is because Apple is known to change the internal working of Xcode with little regards to other third party build tools, such as CMake.
 CMake (http://www.cmake.org) is required to configure and generate the Urho3D project build tree. The minimum required version is 2.8.6. However, it is recommended to use the latest CMake version available out there, especially when targeting Mac OS X and iOS platforms using the latest Xcode version available. This is because Apple is known to change the internal working of Xcode with little regards to other third party build tools, such as CMake.
 
 

+ 17 - 5
Rakefile

@@ -80,7 +80,8 @@ task :cmake do
     ccache_envvar = ENV['CCACHE_SLOPPINESS'] ? '' : 'CCACHE_SLOPPINESS=pch_defines,time_macros'   # Only attempt to do the right thing when user hasn't done it
     ccache_envvar = ENV['CCACHE_SLOPPINESS'] ? '' : 'CCACHE_SLOPPINESS=pch_defines,time_macros'   # Only attempt to do the right thing when user hasn't done it
     ccache_envvar = "#{ccache_envvar} CCACHE_COMPRESS=1" unless ENV['CCACHE_COMPRESS']
     ccache_envvar = "#{ccache_envvar} CCACHE_COMPRESS=1" unless ENV['CCACHE_COMPRESS']
   end
   end
-  system "#{ccache_envvar} ./#{script}#{ENV['OS'] ? '.bat' : '.sh'} \"#{build_tree}\" #{build_options}" or abort
+  system "#{ccache_envvar} ./#{script}#{ENV['OS'] ? '.bat' : '.sh'} \"#{build_tree}\" #{build_options}"
+  exit $?.exitstatus
 end
 end
 
 
 # Usage: rake make [<platform>] [<option>=<value> [<option>=<value>]] [[<platform>_]build_tree=/path/to/build-tree] [numjobs=n] [clean_first] [unfilter]
 # Usage: rake make [<platform>] [<option>=<value> [<option>=<value>]] [[<platform>_]build_tree=/path/to/build-tree] [numjobs=n] [clean_first] [unfilter]
@@ -167,7 +168,8 @@ task :make do
     build_options = "-j#{numjobs}#{build_options}"
     build_options = "-j#{numjobs}#{build_options}"
     filter = ''
     filter = ''
   end
   end
-  system "cd \"#{build_tree}\" && #{ccache_envvar} cmake --build . #{cmake_build_options} -- #{build_options} #{filter}" or abort
+  system "cd \"#{build_tree}\" && #{ccache_envvar} cmake --build . #{cmake_build_options} -- #{build_options} #{filter}"
+  exit $?.exitstatus
 end
 end
 
 
 # Usage: rake android [parameter='--es pickedLibrary Urho3DPlayer:Scripts/NinjaSnowWar.as'] [intent=.SampleLauncher] [package=com.github.urho3d] [success_indicator='Initialized engine'] [payload='sleep 30'] [api=21] [abi=armeabi-v7a] [avd=test_#{api}_#{abi}] [retries=10] [retry_interval=10] [install]
 # Usage: rake android [parameter='--es pickedLibrary Urho3DPlayer:Scripts/NinjaSnowWar.as'] [intent=.SampleLauncher] [package=com.github.urho3d] [success_indicator='Initialized engine'] [payload='sleep 30'] [api=21] [abi=armeabi-v7a] [avd=test_#{api}_#{abi}] [retries=10] [retry_interval=10] [install]
@@ -350,7 +352,11 @@ task :ci do
     system 'rake ci_push_bindings' or abort
     system 'rake ci_push_bindings' or abort
     next
     next
   end
   end
-  system "bash -c 'rake make'" or abort 'Failed to build Urho3D library'
+  if !system "bash -c 'rake make'"
+    abort 'Failed to build Urho3D library' unless $?.exitstatus == 2 && timeup
+    $stderr.puts "Skipped the rest of the CI processes due to insufficient time"
+    next
+  end
   if ENV['URHO3D_TESTING'] && !timeup
   if ENV['URHO3D_TESTING'] && !timeup
     # Multi-config CMake generators use different test target name than single-config ones for no good reason
     # Multi-config CMake generators use different test target name than single-config ones for no good reason
     test = "rake make target=#{ENV['OS'] || ENV['XCODE'] ? 'RUN_TESTS' : 'test'}"
     test = "rake make target=#{ENV['OS'] || ENV['XCODE'] ? 'RUN_TESTS' : 'test'}"
@@ -638,8 +644,14 @@ task :ci_timer do
   timeup
   timeup
 end
 end
 
 
+# Usage: NOT Intended to be used manually
+desc 'Check if the time is up'
+task :ci_timeup do
+  abort "Time up!" if timeup true
+end
+
 # Always call this function last in the multiple conditional check so that the checkpoint message does not being echoed unnecessarily
 # Always call this function last in the multiple conditional check so that the checkpoint message does not being echoed unnecessarily
-def timeup
+def timeup quiet = false
   unless File.exists?('start_time.log')
   unless File.exists?('start_time.log')
     system 'touch start_time.log split_time.log'
     system 'touch start_time.log split_time.log'
     return nil
     return nil
@@ -648,7 +660,7 @@ def timeup
   elapsed_time = (current_time - File.atime('start_time.log')) / 60.0
   elapsed_time = (current_time - File.atime('start_time.log')) / 60.0
   lap_time = (current_time - File.atime('split_time.log')) / 60.0
   lap_time = (current_time - File.atime('split_time.log')) / 60.0
   system 'touch split_time.log'
   system 'touch split_time.log'
-  puts "\n=== elapsed time: #{elapsed_time.to_i} minutes #{((elapsed_time - elapsed_time.to_i) * 60.0).round} seconds, lap time: #{lap_time.to_i} minutes #{((lap_time - lap_time.to_i) * 60.0).round} seconds ===\n\n" unless File.exists?('already_timeup.log'); $stdout.flush
+  puts "\n=== elapsed time: #{elapsed_time.to_i} minutes #{((elapsed_time - elapsed_time.to_i) * 60.0).round} seconds, lap time: #{lap_time.to_i} minutes #{((lap_time - lap_time.to_i) * 60.0).round} seconds ===\n\n" unless quiet || File.exists?('already_timeup.log'); $stdout.flush
   return system('touch already_timeup.log') if elapsed_time > 40.0
   return system('touch already_timeup.log') if elapsed_time > 40.0
 end
 end