Procházet zdrojové kódy

For Travis CI - tune down email notifications frequency.
Add checkpoint for Emscripten CI build and use it to determine whether to skip make test and/or scaffolding test when running short of time.

For Travis CI - perform the full CI jobs for topic branches and PRs.

For Travis CI - use custom data in .travis.yml for excluding samples.

Yao Wei Tjong 姚伟忠 před 10 roky
rodič
revize
fb84bcf179
4 změnil soubory, kde provedl 88 přidání a 58 odebrání
  1. 22 2
      .travis.yml
  2. 20 13
      Rakefile
  3. 46 42
      Source/Samples/CMakeLists.txt
  4. 0 1
      Source/Urho3D/Navigation/NavArea.cpp

+ 22 - 2
.travis.yml

@@ -116,8 +116,10 @@ before_script:
 script: rake ci
 before_cache: ccache -s
 after_success:
-  - if [ $SITE_UPDATE ]; then rake ci_site_update; fi && if [ ${TRAVIS_JOB_NUMBER##*.} == 1 ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then rake ci_create_mirrors; fi
+  - if [ $SITE_UPDATE ]; then rake ci_site_update; fi
+  - if [ ${TRAVIS_JOB_NUMBER##*.} == 1 ]; then rake ci_create_mirrors; fi
   - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; if [ $LINUX ] && [ ! "$URHO3D_64BIT" == "0" ]; then rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi; fi
+notifications: {email: {on_success: never, on_failure: change}}
 
 ---
 
@@ -292,7 +294,7 @@ before_install:
 install:
   - if [ $PACKAGE_UPLOAD ]; then travis_retry brew update >/dev/null && travis_retry brew install doxygen graphviz; fi
   - if [ $XCODE ]; then rvm gemset use global && travis_retry gem install xcpretty; fi
-  - if [ $IOS ]; then export CI_START_TIME=$(date); fi
+  - if [ $IOS ]; then export CI_START_TIME=$(date +%s); fi
 script: rake ci
 after_success: if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
 
@@ -322,9 +324,27 @@ before_install:
 install:
   - if [ $PACKAGE_UPLOAD ]; then travis_retry brew update >/dev/null && travis_retry brew install doxygen graphviz; fi
   - wget https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz && tar xfz emsdk-portable.tar.gz && rm emsdk-portable.tar.gz && cd emsdk_portable && ./emsdk update >/dev/null && sed -i.bak 's/-xvf/-xf/g' emsdk && ./emsdk install latest >/dev/null && ./emsdk activate latest >/dev/null && source ./emsdk_env.sh && export EMSCRIPTEN_ROOT_PATH=$EMSCRIPTEN && export EMSCRIPTEN=1
+before_script: export CI_START_TIME=$(date +%s)
 script: rake ci
 after_success: if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload && rake ci_emscripten_samples_update; fi
 
+# Below samples are excluded from Emscripten CI build due to build time constraint
+data:
+  excluded_sample:
+    - 01_HelloWorld
+    - 02_HelloGUI
+    - 03_Sprites
+    - 04_StaticScene
+    - 05_AnimatingScene
+    - 26_ConsoleInput
+    - 29_SoundSynthesis
+    - 30_LightAnimation
+    - 31_MaterialAnimation
+    - 34_DynamicGeometry
+    - 35_SignedDistanceFieldText
+    - 37_UIDrag
+    - 38_SceneAndUILoad
+
 ...
 
 # vi: set ts=2 sw=2 expandtab:

+ 20 - 13
Rakefile

@@ -22,7 +22,8 @@
 
 require 'pathname'
 require 'json'
-if ENV['IOS']
+require 'yaml'
+if ENV['IOS'] || ENV['EMSCRIPTEN']
   require 'time'
 end
 
@@ -184,6 +185,9 @@ end
 # Usage: NOT intended to be used manually (if you insist then try: rake ci)
 desc 'Configure, build, and test Urho3D project'
 task :ci do
+  # Obtain our custom data, if any
+  data = YAML::load(File.open(".travis.yml"))['data']
+  data['excluded_sample'].each { |name| ENV["EXCLUDE_SAMPLE_#{name}"] = '1' } if data && data['excluded_sample']
   # Unshallow the clone's history when necessary
   if ENV['CI'] && ENV['PACKAGE_UPLOAD'] && !ENV['RELEASE_TAG']
     system 'git fetch --unshallow' or abort 'Failed to unshallow cloned repository'
@@ -273,10 +277,10 @@ task :ci_create_mirrors do
   if `git fetch -qf origin master; git log -1 --pretty=format:'%H' FETCH_HEAD` == ENV['TRAVIS_COMMIT']
     system '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'
     scan = ENV['PACKAGE_UPLOAD'] || /\[ci scan\]/ =~ ENV['COMMIT_MESSAGE']  # Limit the frequency of scanning
-    require 'yaml'
     stream = YAML::load_stream(File.open('.travis.yml'))
-    notifications = stream[0]['notifications'] || { 'email' => `git show -s --format='%ae %ce' #{ENV['TRAVIS_COMMIT']}`.chomp.split.uniq }
-    stream.drop(1).each { |doc| branch = doc.delete('branch'); ci = branch['name']; next unless branch['active'] || (scan && /Scan/ =~ ci); lastjob = doc['matrix'] && doc['matrix']['include'] ? doc['matrix']['include'].length : (doc['env']['matrix'] ? doc['env']['matrix'].length : 1); doc['after_script'] = (lastjob == 1 ? '%s' : "if [ ${TRAVIS_JOB_NUMBER##*.} == #{lastjob} ]; then %s; fi") % 'rake ci_delete_mirror'; doc['notifications'] = notifications unless doc['notifications']; File.open('.travis.yml.doc', 'w') { |file| file.write doc.to_yaml }; ci_branch = ENV['RELEASE_TAG'] || ENV['TRAVIS_BRANCH'] == 'master' ? ci : "#{ENV['TRAVIS_BRANCH']}-#{ci}"; system "if git fetch origin #{ci_branch}:#{ci_branch} 2>/dev/null; then git push -qf origin --delete #{ci_branch} && git branch -D #{ci_branch}; fi && git checkout -b #{ci_branch} #{ENV['RELEASE_TAG'] || ENV['TRAVIS_BRANCH']} && rm .travis.yml && mv .travis.yml.doc .travis.yml && git add -A . && git commit -m '#{branch['description']}' && git push -qf -u origin #{ci_branch} >/dev/null 2>&1" or abort "Failed to create #{ci_branch} mirror branch" }
+    notifications = stream[0]['notifications']
+    notifications['email']['recipients'] = `git show -s --format='%ae %ce' #{ENV['TRAVIS_COMMIT']}`.chomp.split.uniq unless notifications['email']['recipients']
+    stream.drop(1).each { |doc| branch = doc.delete('branch'); ci = branch['name']; next unless branch['active'] || (scan && /Scan/ =~ ci); lastjob = doc['matrix'] && doc['matrix']['include'] ? doc['matrix']['include'].length : (doc['env']['matrix'] ? doc['env']['matrix'].length : 1); doc['after_script'] = (lastjob == 1 ? '%s' : "if [ ${TRAVIS_JOB_NUMBER##*.} == #{lastjob} ]; then %s; fi") % 'rake ci_delete_mirror'; doc['notifications'] = notifications unless doc['notifications']; File.open('.travis.yml.doc', 'w') { |file| file.write doc.to_yaml }; ci_branch = ENV['RELEASE_TAG'] || (ENV['TRAVIS_BRANCH'] == 'master' && ENV['TRAVIS_PULL_REQUEST'] == 'false') ? ci : (ENV['TRAVIS_PULL_REQUEST'] == 'false' ? "#{ENV['TRAVIS_BRANCH']}-#{ci}" : "PR ##{ENV['TRAVIS_PULL_REQUEST']}-#{ci}"); system "git checkout -B #{ci_branch} && rm .travis.yml && mv .travis.yml.doc .travis.yml && git add -A . && git commit -m '#{branch['description']}' && git push -qf -u origin #{ci_branch} >/dev/null 2>&1" or abort "Failed to create #{ci_branch} mirror branch" }
   end
 end
 
@@ -315,7 +319,7 @@ task :ci_package_upload do
   if ENV['IOS']
     # Skip Mach-O universal binary build if Travis-CI VM took too long to get here, as otherwise overall build time may exceed 50 minutes time limit
     if ENV['CI_START_TIME'] then
-      elapsed_time = (Time.now - Time.parse(ENV['CI_START_TIME'])) / 60
+      elapsed_time = (Time.now - Time.at(ENV['CI_START_TIME'].to_i)) / 60
       puts "\niOS checkpoint reached, elapsed time: #{elapsed_time}\n\n"
     end
     if !ENV['CI_START_TIME'] || elapsed_time < 15 # minutes
@@ -435,12 +439,10 @@ EOF
 end
 
 def makefile_ci
-  if ENV['WINDOWS'] && ENV['CI']
-    # LuaJIT on MinGW build is not possible on Ubuntu 12.04 LTS as its GCC cross-compiler version is too old. Fallback to use Lua library instead.
-    jit = ''
-    amalg = ''
-  elsif (ENV['ANDROID'] && ENV['ABI'] == 'arm64-v8a') || ENV['EMSCRIPTEN']
-    # The upstream LuaJIT library does not support this Android ABI at the moment; LuaJIT on Emscripten is not possible
+  if (ENV['WINDOWS'] && ENV['CI']) || (ENV['ANDROID'] && ENV['ABI'] == 'arm64-v8a') || ENV['EMSCRIPTEN']
+    # LuaJIT on MinGW build is not possible on Ubuntu 12.04 LTS as its GCC cross-compiler version is too old
+    # The upstream LuaJIT library does not support Android arm64-v8a ABI at the moment
+    # LuaJIT on Emscripten is not possible
     # Fallback to use Lua library instead
     jit = ''
     amalg = ''
@@ -452,9 +454,14 @@ def makefile_ci
   if ENV['AVD'] && !ENV['PACKAGE_UPLOAD']   # Skip APK test run when packaging
     android_prepare_device ENV['API'], ENV['ABI'], ENV['AVD'] or abort 'Failed to prepare Android (virtual) device for test run'
   end
-  test = $testing == 1 ? (ENV['EMSCRIPTEN'] ? '&& (%s || true)' : '&& %s') % 'make test' : ''   # Temporary workaround for emrun intermitten issue on Travis CI VM
+  # For Emscripten CI build, skip make test and/or scaffolding test if Travis-CI VM took too long to get here, as otherwise overall build time may exceed 50 minutes time limit
+  test = $testing == 1 ? (ENV['CI'] && ENV['EMSCRIPTEN'] ? '&& (if (( $((($(date +%s)-$CI_START_TIME)/60)) < 25 )); then %s; fi || true)' : '&& %s') % 'make test' : ''
   system "cd ../Build && make -j$NUMJOBS #{test}" or abort 'Failed to build or test Urho3D library'
-  unless ENV['CI'] && ENV['EMSCRIPTEN'] && ENV['PACKAGE_UPLOAD']   # Skip scaffolding test when packaging for Emscripten
+  if ENV['CI_START_TIME'] then
+    elapsed_time = (Time.now - Time.at(ENV['CI_START_TIME'].to_i)) / 60
+    puts "\nEmscripten checkpoint reached, elapsed time: #{elapsed_time}\n\n"
+  end
+  unless ENV['CI'] && ENV['EMSCRIPTEN'] && ENV['PACKAGE_UPLOAD'] && elapsed_time > 40  # Skip scaffolding test when packaging for Emscripten
     # Create a new project on the fly that uses newly built Urho3D library in the build tree
     scaffolding "../Build/generated/UsingBuildTree"
     system "cd ../Build/generated/UsingBuildTree && echo '\nExternal project referencing Urho3D library in its build tree' && ./cmake_generic.sh . #{$build_options} -DURHO3D_HOME=../.. -DURHO3D_LUA#{jit}=1 -DURHO3D_TESTING=#{$testing} -DCMAKE_BUILD_TYPE=#{$configuration} && make -j$NUMJOBS #{test}" or abort 'Failed to configure/build/test temporary project using Urho3D as external library'

+ 46 - 42
Source/Samples/CMakeLists.txt

@@ -33,60 +33,64 @@ set (COMMON_SAMPLE_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Sample.h" "${CMAKE_CURRE
 # Define dependency libs
 set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
 
+# Macro for adding sample subdirectory
+macro (add_sample_subdirectory SOURCE_DIR)
+    if (NOT DEFINED ENV{EXCLUDE_SAMPLE_${SOURCE_DIR}})
+        add_subdirectory (${SOURCE_DIR} ${ARGN})
+    endif ()
+endmacro ()
+
 # Add samples
-if (NOT DEFINED ENV{CI} OR NOT EMSCRIPTEN)
-    # Below samples are excluded from Emscripten CI build due to build time constraint, they are included in a normal (non-CI) Emscripten build
-    add_subdirectory (01_HelloWorld)
-    add_subdirectory (02_HelloGUI)
-    add_subdirectory (03_Sprites)
-    add_subdirectory (04_StaticScene)
-    add_subdirectory (05_AnimatingScene)
-    add_subdirectory (26_ConsoleInput)
-    add_subdirectory (29_SoundSynthesis)
-    add_subdirectory (30_LightAnimation)
-    add_subdirectory (31_MaterialAnimation)
-    add_subdirectory (34_DynamicGeometry)
-    add_subdirectory (35_SignedDistanceFieldText)
-    add_subdirectory (37_UIDrag)
-    add_subdirectory (38_SceneAndUILoad)
-endif ()
-add_subdirectory (06_SkeletalAnimation)
-add_subdirectory (07_Billboards)
-add_subdirectory (08_Decals)
-add_subdirectory (09_MultipleViewports)
-add_subdirectory (10_RenderToTexture)
+add_sample_subdirectory (01_HelloWorld)
+add_sample_subdirectory (02_HelloGUI)
+add_sample_subdirectory (03_Sprites)
+add_sample_subdirectory (04_StaticScene)
+add_sample_subdirectory (05_AnimatingScene)
+add_sample_subdirectory (06_SkeletalAnimation)
+add_sample_subdirectory (07_Billboards)
+add_sample_subdirectory (08_Decals)
+add_sample_subdirectory (09_MultipleViewports)
+add_sample_subdirectory (10_RenderToTexture)
+add_sample_subdirectory (14_SoundEffects)
+add_sample_subdirectory (20_HugeObjectCount)
+add_sample_subdirectory (23_Water)
+add_sample_subdirectory (26_ConsoleInput)
+add_sample_subdirectory (29_SoundSynthesis)
+add_sample_subdirectory (30_LightAnimation)
+add_sample_subdirectory (31_MaterialAnimation)
+add_sample_subdirectory (34_DynamicGeometry)
+add_sample_subdirectory (35_SignedDistanceFieldText)
+add_sample_subdirectory (37_UIDrag)
+add_sample_subdirectory (38_SceneAndUILoad)
 if (URHO3D_PHYSICS)
-    add_subdirectory (11_Physics)
-    add_subdirectory (12_PhysicsStressTest)
-    add_subdirectory (13_Ragdolls)
-    add_subdirectory (18_CharacterDemo)
-    add_subdirectory (19_VehicleDemo)
+    add_sample_subdirectory (11_Physics)
+    add_sample_subdirectory (12_PhysicsStressTest)
+    add_sample_subdirectory (13_Ragdolls)
+    add_sample_subdirectory (18_CharacterDemo)
+    add_sample_subdirectory (19_VehicleDemo)
 endif ()
-add_subdirectory (14_SoundEffects)
 if (URHO3D_NAVIGATION)
-    add_subdirectory (15_Navigation)
-    add_subdirectory (39_CrowdNavigation)
+    add_sample_subdirectory (15_Navigation)
+    add_sample_subdirectory (39_CrowdNavigation)
 endif ()
 if (URHO3D_NETWORK)
-    add_subdirectory (16_Chat)
+    add_sample_subdirectory (16_Chat)
 endif ()
 if (URHO3D_NETWORK AND URHO3D_PHYSICS)
-    add_subdirectory (17_SceneReplication)
+    add_sample_subdirectory (17_SceneReplication)
 endif ()
-add_subdirectory (20_HugeObjectCount)
 if (URHO3D_ANGELSCRIPT)
-    add_subdirectory (21_AngelScriptIntegration)
+    add_sample_subdirectory (21_AngelScriptIntegration)
 endif ()
 if (URHO3D_LUA)
-    add_subdirectory (22_LuaIntegration)
+    add_sample_subdirectory (22_LuaIntegration)
 endif ()
-add_subdirectory (23_Water)
 if (URHO3D_URHO2D)
-    add_subdirectory (24_Urho2DSprite)
-    add_subdirectory (25_Urho2DParticle)
-    add_subdirectory (27_Urho2DPhysics)
-    add_subdirectory (28_Urho2DPhysicsRope)
-    add_subdirectory (32_Urho2DConstraints)
-    add_subdirectory (33_Urho2DSpriterAnimation)
-    add_subdirectory (36_Urho2DTileMap)
+    add_sample_subdirectory (24_Urho2DSprite)
+    add_sample_subdirectory (25_Urho2DParticle)
+    add_sample_subdirectory (27_Urho2DPhysics)
+    add_sample_subdirectory (28_Urho2DPhysicsRope)
+    add_sample_subdirectory (32_Urho2DConstraints)
+    add_sample_subdirectory (33_Urho2DSpriterAnimation)
+    add_sample_subdirectory (36_Urho2DTileMap)
 endif ()

+ 0 - 1
Source/Urho3D/Navigation/NavArea.cpp

@@ -30,7 +30,6 @@ namespace Urho3D
 {
     static const Vector3 DEFAULT_BOUNDING_BOX_MIN(-10.0f, -10.0f, -10.0f);
     static const Vector3 DEFAULT_BOUNDING_BOX_MAX(10.0f, 10.0f, 10.0f);
-    static const unsigned DEFAULT_MASK_FLAG = 0;
     static const unsigned DEFAULT_AREA = 0;
 
     extern const char* NAVIGATION_CATEGORY;