|
@@ -22,7 +22,8 @@
|
|
|
|
|
|
|
|
require 'pathname'
|
|
require 'pathname'
|
|
|
require 'json'
|
|
require 'json'
|
|
|
-if ENV['IOS']
|
|
|
|
|
|
|
+require 'yaml'
|
|
|
|
|
+if ENV['IOS'] || ENV['EMSCRIPTEN']
|
|
|
require 'time'
|
|
require 'time'
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -184,6 +185,9 @@ end
|
|
|
# Usage: NOT intended to be used manually (if you insist then try: rake ci)
|
|
# Usage: NOT intended to be used manually (if you insist then try: rake ci)
|
|
|
desc 'Configure, build, and test Urho3D project'
|
|
desc 'Configure, build, and test Urho3D project'
|
|
|
task :ci do
|
|
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
|
|
# Unshallow the clone's history when necessary
|
|
|
if ENV['CI'] && ENV['PACKAGE_UPLOAD'] && !ENV['RELEASE_TAG']
|
|
if ENV['CI'] && ENV['PACKAGE_UPLOAD'] && !ENV['RELEASE_TAG']
|
|
|
system 'git fetch --unshallow' or abort 'Failed to unshallow cloned repository'
|
|
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']
|
|
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'
|
|
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
|
|
scan = ENV['PACKAGE_UPLOAD'] || /\[ci scan\]/ =~ ENV['COMMIT_MESSAGE'] # Limit the frequency of scanning
|
|
|
- require 'yaml'
|
|
|
|
|
stream = YAML::load_stream(File.open('.travis.yml'))
|
|
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
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -315,7 +319,7 @@ task :ci_package_upload do
|
|
|
if ENV['IOS']
|
|
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
|
|
# 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
|
|
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"
|
|
puts "\niOS checkpoint reached, elapsed time: #{elapsed_time}\n\n"
|
|
|
end
|
|
end
|
|
|
if !ENV['CI_START_TIME'] || elapsed_time < 15 # minutes
|
|
if !ENV['CI_START_TIME'] || elapsed_time < 15 # minutes
|
|
@@ -435,12 +439,10 @@ EOF
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def makefile_ci
|
|
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
|
|
# Fallback to use Lua library instead
|
|
|
jit = ''
|
|
jit = ''
|
|
|
amalg = ''
|
|
amalg = ''
|
|
@@ -452,9 +454,14 @@ def makefile_ci
|
|
|
if ENV['AVD'] && !ENV['PACKAGE_UPLOAD'] # Skip APK test run when packaging
|
|
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'
|
|
android_prepare_device ENV['API'], ENV['ABI'], ENV['AVD'] or abort 'Failed to prepare Android (virtual) device for test run'
|
|
|
end
|
|
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'
|
|
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
|
|
# Create a new project on the fly that uses newly built Urho3D library in the build tree
|
|
|
scaffolding "../Build/generated/UsingBuildTree"
|
|
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'
|
|
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'
|