Browse Source

For AppVeyor CI - bring checkpoint timer to AppVeyor.

Yao Wei Tjong 姚伟忠 9 years ago
parent
commit
15a90276f5
3 changed files with 31 additions and 29 deletions
  1. 2 1
      .appveyor.yml
  2. 15 15
      .travis.yml
  3. 14 13
      Rakefile

+ 2 - 1
.appveyor.yml

@@ -46,6 +46,7 @@ environment:
     - URHO3D_LIB_TYPE: STATIC
     - URHO3D_LIB_TYPE: SHARED
 install:
+  - rake ci_timer
   - ps: if ($env:APPVEYOR_REPO_TAG -eq "true") { $env:RELEASE_TAG = $env:APPVEYOR_REPO_TAG_NAME };
         if ($env:RELEASE_TAG -or ($env:APPVEYOR_REPO_BRANCH -eq "master" -and (!$env:APPVEYOR_PULL_REQUEST_NUMBER -and (select-string '\[ci package\]' -inputobject $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED))))
         {
@@ -62,7 +63,7 @@ build_script:
   - if "%PLATFORM%" == "x64" set "URHO3D_64BIT=1"
 # Our free AppVeyor account is slow for normal daily CI, speed up the build a little bit by excluding Assimp and other tools in the normal build and use the Debug build configuration instead
   - if "%PACKAGE_UPLOAD%" == "" set "URHO3D_TOOLS=0" && set "config=Debug"
-  - rake ci && if "%PACKAGE_UPLOAD%" == "1" rake ci_package_upload
+  - rake ci && if "%PACKAGE_UPLOAD%" == "1" rake ci_package_upload && rake ci_timer
 test: off
 artifacts:
   - path: Build\*.zip

+ 15 - 15
.travis.yml

@@ -104,7 +104,7 @@ matrix:
     # compiler: i686-w64-mingw32-gcc-d3d11-shared
     # env: WIN32=1 URHO3D_LIB_TYPE=SHARED URHO3D_64BIT=0 URHO3D_D3D11=1
 before_script:
-  - SECONDS=0
+  - rake ci_timer
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
   - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then if [ ${TRAVIS_JOB_NUMBER##*.} == 1 ]; then export SITE_UPDATE=1; fi; if [ "$CC" == "gcc" ] && ([ $RELEASE_TAG ] || echo $COMMIT_MESSAGE |grep -cq '\[ci package\]'); then export PACKAGE_UPLOAD=1; fi; fi
@@ -118,9 +118,9 @@ before_script:
   # For some reason clang compiler toolchain installation in Travis CI VM does not have symlink in the ccache symlinks directory, so workaround it
   - if [ "$CC"  == "clang" ]; then ln -s $(which ccache) $HOME/clang && ln -s $(which ccache) $HOME/clang++ && export PATH=$HOME:$PATH; fi
   - rake ci_setup_cache
-script: ELAPSED=$SECONDS rake ci && if [ $SITE_UPDATE ]; then ELAPSED=$SECONDS rake ci_site_update; fi && if [ $PACKAGE_UPLOAD ]; then ELAPSED=$SECONDS rake ci_package_upload && if [ $LINUX ] && [ ! "$URHO3D_64BIT" == "0" ]; then ELAPSED=$SECONDS rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi; fi
+script: rake ci && if [ $SITE_UPDATE ]; then rake ci_site_update; 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
 after_script:
-  - rake ci_teardown_cache
+  - rake ci_timer && rake ci_teardown_cache
   - if [ ${TRAVIS_JOB_NUMBER##*.} == 1 ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then rake ci_create_mirrors; fi
 notifications: {email: {on_success: never, on_failure: change}}
 
@@ -273,7 +273,7 @@ matrix:
     - addons: {<<: *newer_gcc}
       env: ANDROID_ABI=arm64-v8a URHO3D_LIB_TYPE=SHARED NO_SDK_SYSIMG=1
 before_script:
-  - SECONDS=0
+  - rake ci_timer
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
@@ -285,8 +285,8 @@ before_script:
   - if [ "$ANDROID_ABI" == "armeabi-v7a" ]; then export C_PATH=$(pwd)/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin C_PREFIX=arm-linux-androideabi; fi
   - export PATH=$(whereis -b ccache |grep -o '\S*lib\S*'):$C_PATH:$PATH; for f in $C_PATH/$C_PREFIX-{gcc,g++}; do touch -d "2015-01-01 00:00:00 +0800" $f; done
   - rake ci_setup_cache
-script: ELAPSED=$SECONDS rake ci && if [ $PACKAGE_UPLOAD ]; then ELAPSED=$SECONDS rake ci_package_upload; fi
-after_script: rake ci_teardown_cache
+script: rake ci && if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
+after_script: rake ci_timer && rake ci_teardown_cache
 
 ---
 
@@ -322,7 +322,7 @@ matrix:
     - compiler: gcc-armeabi-v7a-with-NEON-shared
       env: URHO3D_LIB_TYPE=SHARED RPI_ABI='armeabi-v7a with NEON'
 before_script:
-  - SECONDS=0
+  - rake ci_timer
   - git clone --depth 1 https://github.com/raspberrypi/tools.git rpi-tools && export RPI_PREFIX=$(pwd)/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf && git clone --depth 1 https://github.com/urho3d/rpi-sysroot.git && export RPI_SYSROOT=$(pwd)/rpi-sysroot && for f in $RPI_PREFIX-{gcc,g++}; do touch -d "2015-01-01 00:00:00 +0800" $f; done
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
@@ -330,8 +330,8 @@ before_script:
   - if [ ${TRAVIS_JOB_NUMBER##*.} -lt $PACKAGE_JOB_END ] && ([ $RELEASE_TAG ] || (! [[ $TRAVIS_BRANCH =~ [^-]+-[^-]+-CI ]] && echo $COMMIT_MESSAGE |grep -cq '\[ci package\]')); then export PACKAGE_UPLOAD=1; fi
   - export PATH=$(whereis -b ccache |grep -o '\S*lib\S*'):${RPI_PREFIX%/*}:$PATH
   - rake ci_setup_cache
-script: ELAPSED=$SECONDS rake ci && if [ $PACKAGE_UPLOAD ]; then ELAPSED=$SECONDS rake ci_package_upload; fi
-after_script: rake ci_teardown_cache
+script: rake ci && if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
+after_script: rake ci_timer && rake ci_teardown_cache
 
 ---
 
@@ -357,7 +357,7 @@ env:
 matrix:
   fast_finish: true
 before_script:
-  - SECONDS=0
+  - rake ci_timer
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
@@ -371,8 +371,8 @@ before_script:
   - export PATH=$(brew info ccache |grep -o '\S*lib\S*'):$PATH
   - if [ $XCODE ]; then sudo cp -p $(which ccache) $(dirname $(xcodebuild -find-executable clang)) && for compiler in clang clang++; do path=$(xcodebuild -find-executable $compiler); sudo mv $path{,.orig} && sudo ln -sf $(dirname $path)/clang.orig /usr/bin/$compiler && sudo ln -sf ccache $path; done && if [ $IOS ]; then redundant=AppleTV,Watch; elif [ $TVOS ]; then redundant=iPhone,Watch; else redundant=iPhone,AppleTV,Watch; fi && eval sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/{$redundant}{OS,Simulator}.platform; fi
   - rake ci_setup_cache
-script: ELAPSED=$SECONDS rake ci && if [ $PACKAGE_UPLOAD ]; then ELAPSED=$SECONDS rake ci_package_upload; fi
-after_script: rake ci_teardown_cache
+script: rake ci && if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
+after_script: rake ci_timer && rake ci_teardown_cache
 
 ---
 
@@ -400,7 +400,7 @@ matrix:
     - compiler: gcc-linked-bitcode
       env: URHO3D_LIB_TYPE=SHARED
 before_script:
-  - SECONDS=0
+  - rake ci_timer
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
@@ -409,8 +409,8 @@ before_script:
   - git clone --depth 1 https://github.com/urho3d/emscripten-sdk.git && emscripten-sdk/emsdk activate --build=Release sdk-master-64bit && source emscripten-sdk/emsdk_env.sh
   - export PATH=$(whereis -b ccache |grep -o '\S*lib\S*'):$PATH; for f in $EMSCRIPTEN/{emcc,em++}; do touch -d "2015-09-01 00:00:00 +0800" $f; done
   - rake ci_setup_cache
-script: ELAPSED=$SECONDS rake ci && if [ $PACKAGE_UPLOAD ]; then ELAPSED=$SECONDS rake ci_package_upload && if [ "$URHO3D_LIB_TYPE" == "SHARED" ]; then ELAPSED=$SECONDS rake ci_emscripten_samples_update; fi; fi
-after_script: rake ci_teardown_cache
+script: rake ci && if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload && if [ "$URHO3D_LIB_TYPE" == "SHARED" ]; then rake ci_emscripten_samples_update; fi; fi
+after_script: rake ci_timer && rake ci_teardown_cache
 
 ...
 

+ 14 - 13
Rakefile

@@ -297,7 +297,6 @@ end
 # Usage: NOT intended to be used manually
 desc 'Configure, build, and test Urho3D project'
 task :ci do
-  $start_time = Time.now - ENV['ELAPSED'].to_i if ENV['ELAPSED']
   next if timeup    # Measure the VM overhead
   # Skip if only performing CI for selected branches and the current branch is not in the list
   unless ENV['RELEASE_TAG']
@@ -387,7 +386,7 @@ task :ci do
     end
   end
   # Make, deploy, and test run Android APK in an Android (virtual) device
-  if ENV['AVD'] && !ENV['PACKAGE_UPLOAD']
+  if ENV['AVD'] && !ENV['PACKAGE_UPLOAD'] && !timeup
     puts "\nTest deploying and running Urho3D Samples APK..."
     Dir.chdir '../Build' do
       system 'android update project -p . && ant debug' or abort 'Failed to make Urho3D Samples APK'
@@ -442,7 +441,6 @@ desc 'Update site on GitHub Pages (and source tree on GitHub while we are at it)
 task :ci_site_update do
   # Skip when :ci rake task was skipped
   next unless File.exist?('../Build/CMakeCache.txt')
-  $start_time = Time.now - ENV['ELAPSED'].to_i if ENV['ELAPSED']
   next if timeup
   puts "Updating site...\n\n"
   system 'git clone --depth 1 -q https://github.com/urho3d/urho3d.github.io.git ../urho3d.github.io' or abort 'Failed to clone urho3d/urho3d.github.io'
@@ -485,7 +483,6 @@ end
 # Usage: NOT intended to be used manually
 desc 'Update web samples to GitHub Pages'
 task :ci_emscripten_samples_update do
-  $start_time = Time.now - ENV['ELAPSED'].to_i if ENV['ELAPSED']
   next if timeup
   puts 'Updating Web samples in main website...'
   system 'git clone --depth 1 -q https://github.com/urho3d/urho3d.github.io.git ../urho3d.github.io' or abort 'Failed to clone urho3d/urho3d.github.io'
@@ -556,7 +553,6 @@ task :ci_package_upload do
   ENV['config'] = 'Release' if ENV['XCODE']
   # Skip when :ci rake task was skipped
   next unless File.exist?("#{ENV['build_tree']}/CMakeCache.txt")
-  $start_time = Time.now - ENV['ELAPSED'].to_i if ENV['ELAPSED']
   next if timeup
   # Generate the documentation if necessary
   if ENV['SITE_UPDATE']
@@ -636,19 +632,24 @@ EOF'" or abort 'Failed to create release directory remotely'
   end
 end
 
+# Usage: NOT intended to be used manually
+desc 'Start/stop the timer'
+task :ci_timer do
+  timeup
+end
+
 # Always call this function last in the multiple conditional check so that the checkpoint message does not being echoed unnecessarily
 def timeup
-  unless $start_time
-    puts; $stdout.flush
+  unless File.exists?('start_time.log')
+    system 'touch start_time.log split_time.log'
     return nil
   end
   current_time = Time.now
-  elapsed_time = (current_time - $start_time) / 60.0
-  lap_time = $split_time ? (current_time - $split_time) / 60.0 : 0.0
-  $split_time = current_time
-  puts "\n=== Checkpoint reached, 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 $already_timeup
-  $stdout.flush
-  return $already_timeup = elapsed_time > 40.0
+  elapsed_time = (current_time - File.atime('start_time.log')) / 60.0
+  lap_time = (current_time - File.atime('split_time.log')) / 60.0
+  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
+  return system('touch already_timeup.log') if elapsed_time > 40.0
 end
 
 def scaffolding dir, project = 'Scaffolding', target = 'Main'