ソースを参照

Misc. fixes in the build script to improve the release mechanism.
The following changes address the shortcomings of our current release mechanism detected from our last release.
- Define and set RELEASE_TAG environment variable only when a git tag conform to a release tagging matching regex "\d+\.\d+".
- Change the logic to allow the automated rake tasks to be triggered on a 'tag' branch properly.
- Fix the 'git rebase' command to use the branch pointed by TRAVIS_BRANCH environment variable as baseline, instead of assuming it to be always 'origin/master' as before.
- Change Urho3D library versioning CMake module to omit the version patch number when there is none, i.e. 1.32 instead of 1.32.0.

Yao Wei Tjong 姚伟忠 11 年 前
コミット
e7b0808b12
4 ファイル変更10 行追加13 行削除
  1. 2 2
      .travis.yml
  2. 6 7
      Rakefile
  3. 1 3
      Source/CMake/Modules/GetUrho3DRevision.cmake
  4. 1 1
      Source/CMakeLists.txt

+ 2 - 2
.travis.yml

@@ -54,8 +54,8 @@ matrix:
       env: LINUX=1 URHO3D_LIB_TYPE=SHARED URHO3D_64BIT=0
 before_install:
   - free -tm
-  - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export TRAVIS_BRANCH=master; fi
-  - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then export SITE_UPDATE_ON_MASTER_COMMIT=$SITE_UPDATE; export RELEASE_TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT); if [ "$CC" == "gcc" ] && ([ $RELEASE_TAG ] || echo $COMMIT_MESSAGE |grep -cq '\[ci package\]'); then export PACKAGE_UPLOAD=1; fi; fi
+  - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
+  - if [ $RELEASE_TAG ] || ([ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]); then export SITE_UPDATE_ON_MASTER_COMMIT=$SITE_UPDATE; export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT); if [ "$CC" == "gcc" ] && ([ $RELEASE_TAG ] || echo $COMMIT_MESSAGE |grep -cq '\[ci package\]'); then export PACKAGE_UPLOAD=1; fi; fi
   - if [ "$SITE_UPDATE_ON_MASTER_COMMIT" -o "$PACKAGE_UPLOAD" ]; then travis_retry sudo add-apt-repository ppa:george-edison55/precise-backports -y; fi
   - travis_retry sudo apt-get update -q -y
 install:

+ 6 - 7
Rakefile

@@ -73,7 +73,7 @@ end
 desc 'Configure, build, and test Urho3D project'
 task :ci do
   # Unshallow the clone's history when necessary
-  if ENV['CI'] && ENV['PACKAGE_UPLOAD'] && ENV['RELEASE_TAG'].empty?
+  if ENV['CI'] && ENV['PACKAGE_UPLOAD'] && !ENV['RELEASE_TAG']
     system 'git fetch --unshallow' or abort 'Failed to unshallow cloned repository'
   end
   # Packaging always use Release configuration (temporary workaround due to Travis-CI insufficient memory, also always use Release configuration for MinGW and Android build)
@@ -108,7 +108,7 @@ task :ci_site_update do
   # Setup doxygen to use minimal theme
   system "ruby -i -pe 'BEGIN { a = {%q{HTML_HEADER} => %q{minimal-header.html}, %q{HTML_FOOTER} => %q{minimal-footer.html}, %q{HTML_STYLESHEET} => %q{minimal-doxygen.css}, %q{HTML_COLORSTYLE_HUE} => 200, %q{HTML_COLORSTYLE_SAT} => 0, %q{HTML_COLORSTYLE_GAMMA} => 20, %q{DOT_IMAGE_FORMAT} => %q{svg}, %q{INTERACTIVE_SVG} => %q{YES}} }; a.each {|k, v| gsub(/\#{k}\s*?=.*?\n/, %Q{\#{k} = \#{v}\n}) }' Docs/Doxyfile" or abort 'Failed to setup doxygen configuration file'
   system 'cp doc-Build/_includes/Doxygen/minimal-* Docs' or abort 'Failed to copy minimal-themed template'
-  release = ENV['RELEASE_TAG'].empty? ? 'HEAD' : ENV['RELEASE_TAG'];
+  release = ENV['RELEASE_TAG'] || 'HEAD'
   unless release == 'HEAD'
     system "mkdir -p doc-Build/documentation/#{release}" or abort 'Failed to create directory for new document version'
     system "ruby -i -pe 'gsub(/HEAD/, %q{#{release}})' Docs/minimal-header.html" or abort 'Failed to update document version in YAML Front Matter block'
@@ -134,11 +134,10 @@ task :ci_site_update do
 end
 
 # Usage: NOT intended to be used manually (if you insist then try: GIT_NAME=... GIT_EMAIL=... GH_TOKEN=... rake ci_rebase)
-desc 'Rebase Android-CI and OSX-CI mirror branches'
+desc 'Rebase all CI mirror branches'
 task :ci_rebase do
-  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 && git fetch origin Android-CI:Android-CI && git rebase origin/master Android-CI && git push -qf -u origin Android-CI >/dev/null 2>&1' or abort 'Failed to rebase Android-CI mirror branch'
-  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 && git fetch origin RPI-CI:RPI-CI && git rebase origin/master RPI-CI && git push -qf -u origin RPI-CI >/dev/null 2>&1' or abort 'Failed to rebase RPI-CI mirror branch'
-  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 && git fetch origin OSX-CI:OSX-CI && git rebase origin/master OSX-CI && git push -qf -u origin OSX-CI >/dev/null 2>&1' or abort 'Failed to rebase OSX-CI mirror branch'
+  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'
+  [ 'Android-CI', 'RPI-CI', 'OSX-CI' ].each { |branch| system "git fetch origin #{branch}:#{branch} && git rebase #{ENV['TRAVIS_BRANCH']} #{branch} && git push -qf -u origin #{branch} >/dev/null 2>&1" or abort "Failed to rebase #{branch} mirror branch" }
 end
 
 # Usage: NOT intended to be used manually (if you insist then try: rake ci_package_upload)
@@ -192,7 +191,7 @@ task :ci_package_upload do
   end
   # Determine the upload location
   setup_digital_keys
-  if ENV['RELEASE_TAG'].empty?
+  if !ENV['RELEASE_TAG']
     upload_dir = "/home/frs/project/#{ENV['TRAVIS_REPO_SLUG']}/Snapshots"
     if ENV['SITE_UPDATE']
       # Download source packages from GitHub

+ 1 - 3
Source/CMake/Modules/GetUrho3DRevision.cmake

@@ -43,11 +43,9 @@ else ()
         string (REGEX MATCH "${VERSION}-([^-]+)" PATCH ${LIB_REVISION})     # Subsequent commits count after a release tag is treated as patch number
         if (PATCH)
             set (VERSION ${VERSION}.${CMAKE_MATCH_1})
-        else ()
-            set (VERSION ${VERSION}.0)
         endif ()
     else ()
-        set (VERSION 0.0.0)
+        set (VERSION 0.0)
     endif ()
     execute_process (COMMAND ${CMAKE_COMMAND} -E echo ${VERSION})
 endif ()

+ 1 - 1
Source/CMakeLists.txt

@@ -126,7 +126,7 @@ if (WIN32 AND NOT URHO3D_OPENGL)
 elseif (ANDROID AND X86)    # Take advantage of Android toolchain setting X86 variable to true for both 'x86' and 'x86_64' ABIs
     set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-IA)     # Stands for Intel Architecture
 endif ()
-if ("$ENV{RELEASE_TAG}" STREQUAL "")
+if (NOT DEFINED ENV{RELEASE_TAG})
     set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-snapshot)
 endif ()
 include (CPack)