This reverts commit 464c19f391
.
This commit is contained in:
parent
35ad136ad8
commit
a8f961d2c1
|
@ -0,0 +1,52 @@
|
|||
language: c
|
||||
|
||||
os: osx
|
||||
osx_image:
|
||||
- xcode10.1
|
||||
- xcode10.3
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- /usr/local/Homebrew/Library/Homebrew/vendor/bundle
|
||||
- /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby
|
||||
|
||||
install:
|
||||
- |
|
||||
# Force strict error checking.
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
- |
|
||||
# Update Travis commit range.
|
||||
# This is not normally required but does prevent problems with outdated forks and
|
||||
# deleted casks (see https://github.com/Homebrew/homebrew-cask/pull/43164).
|
||||
BRANCH_COMMIT="${TRAVIS_COMMIT_RANGE##*.}"
|
||||
TARGET_COMMIT="${TRAVIS_COMMIT_RANGE%%.*}"
|
||||
if ! MERGE_BASE="$(git merge-base "${BRANCH_COMMIT}" "${TARGET_COMMIT}" 2>/dev/null)"; then
|
||||
git fetch --unshallow
|
||||
MERGE_BASE="$(git merge-base "${BRANCH_COMMIT}" "${TARGET_COMMIT}")"
|
||||
fi
|
||||
export TRAVIS_COMMIT_RANGE="${MERGE_BASE}...${BRANCH_COMMIT}"
|
||||
- |
|
||||
# Switch to master branch.
|
||||
export HOMEBREW_COLOR=1
|
||||
export HOMEBREW_DEVELOPER=1
|
||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
export HOMEBREW_FORCE_BREWED_CURL=1
|
||||
brew update-reset
|
||||
HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST=1 brew config
|
||||
- |
|
||||
# Mirror the repo as a tap.
|
||||
TAP_DIR="$(brew --repository "${TRAVIS_REPO_SLUG}")"
|
||||
mkdir -p "${TAP_DIR}"
|
||||
rsync -az --delete "${TRAVIS_BUILD_DIR}/" "${TAP_DIR}/"
|
||||
export TRAVIS_BUILD_DIR="${TAP_DIR}"
|
||||
builtin cd "${TAP_DIR}"
|
||||
|
||||
script: brew cask ci
|
||||
|
||||
notifications:
|
||||
email: false
|
|
@ -5,6 +5,7 @@ require "utils/formatter"
|
|||
|
||||
require_relative "lib/capture"
|
||||
require_relative "lib/check"
|
||||
require_relative "lib/travis"
|
||||
|
||||
module Cask
|
||||
class Cmd
|
||||
|
@ -157,27 +158,44 @@ module Cask
|
|||
|
||||
private
|
||||
|
||||
def step(name)
|
||||
def step(name, travis_id)
|
||||
unless ENV.key?("TRAVIS_COMMIT_RANGE")
|
||||
puts Formatter.headline(name, color: :yellow)
|
||||
return yield != false
|
||||
end
|
||||
|
||||
success = false
|
||||
output = nil
|
||||
|
||||
print Formatter.headline("#{name} ", color: :yellow)
|
||||
Travis.fold travis_id do
|
||||
print Formatter.headline("#{name} ", color: :yellow)
|
||||
|
||||
real_stdout = $stdout.dup
|
||||
real_stdout = $stdout.dup
|
||||
|
||||
success, output = capture do
|
||||
yield != false
|
||||
rescue => e
|
||||
$stderr.puts e.message
|
||||
$stderr.puts e.backtrace
|
||||
false
|
||||
end
|
||||
travis_wait = Thread.new do
|
||||
loop do
|
||||
sleep 595
|
||||
real_stdout.print "\u200b"
|
||||
end
|
||||
end
|
||||
|
||||
if success
|
||||
puts Formatter.success("✔")
|
||||
puts output unless output.empty?
|
||||
else
|
||||
puts Formatter.error("✘")
|
||||
success, output = capture do
|
||||
yield != false
|
||||
rescue => e
|
||||
$stderr.puts e.message
|
||||
$stderr.puts e.backtrace
|
||||
false
|
||||
end
|
||||
|
||||
travis_wait.kill
|
||||
travis_wait.join
|
||||
|
||||
if success
|
||||
puts Formatter.success("✔")
|
||||
puts output unless output.empty?
|
||||
else
|
||||
puts Formatter.error("✘")
|
||||
end
|
||||
end
|
||||
|
||||
puts output unless success
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
module Travis
|
||||
module_function
|
||||
|
||||
@start = {}
|
||||
|
||||
def fold(id, &block)
|
||||
print fold_start(id)
|
||||
time(rand(2**32).to_s(16), &block)
|
||||
print fold_end(id)
|
||||
end
|
||||
|
||||
def fold_start(id)
|
||||
"travis_fold:start:#{id}\r\033[0K"
|
||||
end
|
||||
|
||||
def fold_end(id)
|
||||
"travis_fold:end:#{id}\r\033[0K"
|
||||
end
|
||||
|
||||
def time(id)
|
||||
print time_start(id)
|
||||
yield
|
||||
print time_end(id)
|
||||
end
|
||||
|
||||
def time_start(id)
|
||||
@start[id] = Time.now
|
||||
"travis_time:start:#{id}\r\033[0K"
|
||||
end
|
||||
|
||||
def time_end(id)
|
||||
start = (@start[id].to_f * 1_000_000_000).to_i
|
||||
finish = (Time.now.to_f * 1_000_000_000).to_i
|
||||
duration = finish - start
|
||||
|
||||
"travis_time:end:#{id},start=#{start},finish=#{finish},duration=#{duration}\r\033[0K"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue