2
0
Эх сурвалжийг харах

For CI - check the time each minute instead of at each post build step.
This should fix 2 things: 1) long running glew compilation being killed by Travis CI due to absent of output; 2) long running universal binary for Urho3D library target on iOS build overshoot the build time limit.

Yao Wei Tjong 姚伟忠 9 жил өмнө
parent
commit
fb47f495da

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

@@ -1028,11 +1028,8 @@ macro (setup_target)
         unset (TARGET_PROPERTIES)
     endif ()
 
-    if (DEFINED ENV{TRAVIS})
-        # Workaround to avoid technical error due to Travis CI build time limit
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND rake ci_timeup WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-    else ()
-        # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red in the Xcode IDE as if they are not yet built
+    # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red in the Xcode IDE as if they are not yet built
+    if (NOT DEFINED ENV{TRAVIS})
         if (XCODE AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
             file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
             get_target_property (LOCATION ${TARGET_NAME} LOCATION)

+ 6 - 13
Rakefile

@@ -350,14 +350,11 @@ task :ci do
     system 'rake ci_push_bindings' or abort
     next
   end
-  # Enable more granular timeup check for Xcode
-  system 'touch enabled_time_check.log' if ENV['XCODE']
-  if !system "bash -c 'rake make'"
+  if wait_for_block { system "bash -c 'rake make'"; Thread.current[:exit_code] = $?.exitstatus } != 0
     abort 'Failed to build Urho3D library' unless File.exists?('already_timeup.log')
     $stderr.puts "Skipped the rest of the CI processes due to insufficient time"
     next
   end
-  File.delete 'enabled_time_check.log' if ENV['XCODE']
   if ENV['URHO3D_TESTING'] && !timeup
     # 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'}"
@@ -370,13 +367,11 @@ task :ci do
   unless ENV['CI'] && (ENV['IOS'] || ENV['WEB']) && ENV['PACKAGE_UPLOAD'] || ENV['XCODE_64BIT_ONLY'] || timeup
     # Staged-install Urho3D SDK when on Travis-CI; normal install when on AppVeyor
     ENV['DESTDIR'] = ENV['HOME'] || Dir.home unless ENV['APPVEYOR']
-    system 'touch enabled_time_check.log' if ENV['XCODE']
     if wait_for_block("Installing Urho3D SDK to #{ENV['DESTDIR'] ? "#{ENV['DESTDIR']}/usr/local" : 'default system-wide location'}...") { system "bash -c 'rake make target=install >/dev/null'"; Thread.current[:exit_code] = $?.exitstatus } != 0
       abort 'Failed to install Urho3D SDK' unless File.exists?('already_timeup.log')
       $stderr.puts "Skipped the rest of the CI processes due to insufficient time"
       next
     end
-    File.delete 'enabled_time_check.log' if ENV['XCODE']
     # Alternate to use in-the-source build tree for test coverage
     ENV['build_tree'] = '.' unless ENV['APPVEYOR']
     # Ensure the following variables are auto-discovered during scaffolding test
@@ -651,12 +646,6 @@ task :ci_timer do
   timeup
 end
 
-# Usage: NOT Intended to be used manually
-desc 'Check if the time is up when the time check is enabled'
-task :ci_timeup do
-  abort "Time up!" if File.exists?('enabled_time_check.log') && timeup(true)
-end
-
 # Always call this function last in the multiple conditional check so that the checkpoint message does not being echoed unnecessarily
 def timeup quiet = false
   unless File.exists?('start_time.log')
@@ -843,12 +832,16 @@ def wait_for_block comment = '', retries = -1, retry_interval = 60, exit_code_sy
       thread.join
       break
     end
+    if timeup(true)
+      thread.kill
+      break
+    end
     print str; str = '.'; $stdout.flush   # Flush the standard output stream in case it is buffered to prevent Travis-CI into thinking that the build/test has stalled
     sleep retry_interval
     retries -= 1 if retries > 0
   end
   puts "\n" if str == '.'; $stdout.flush
-  return retries == 0 ? nil : (exit_code_sym ? thread[exit_code_sym] : 0)
+  return retries == 0 || File.exists?('already_timeup.log') ? nil : (exit_code_sym ? thread[exit_code_sym] : 0)
 end
 
 def append_new_release release, filename = '../urho3d.github.io/_data/urho3d.json'