Skip to content

Commit 07a2d0c

Browse files
Fix Carthage test to use current commit hash
1 parent 6bdbeae commit 07a2d0c

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ osx_image: xcode7.3
33
cache:
44
directories:
55
- Lib/vendor/bundle
6+
before_install:
7+
- brew install jq
68
install:
79
- "(cd Lib && bundle install --path=vendor/bundle --binstubs=vendor/bin)"
810
before_script:

Lib/Rakefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,19 @@ namespace :test do
9393
end
9494
end
9595

96+
def branch_name
97+
if ENV['CI']
98+
pull_req = %[https://api.github.com/repos/#{ENV['TRAVIS_REPO_SLUG']}/pulls/#{ENV['TRAVIS_PULL_REQUEST']}]
99+
auth_token = 'kishikawakatsumi:209558699492df7782fbe62dda1891d6a6ba010f'
100+
(ENV['TRAVIS_PULL_REQUEST'] == 'false' ? ENV['TRAVIS_BRANCH'] : `curl -u #{auth_token} -s #{pull_req} | jq -r .head.ref`).strip
101+
else
102+
%x[git rev-parse --abbrev-ref HEAD]
103+
end
104+
end
105+
96106
task :carthage do
97-
sh 'echo "github \"kishikawakatsumi/KeychainAccess\" \"${sha:-master}"\" > Cartfile'
98-
sh 'carthage update --no-use-binaries'
107+
sh %[echo 'github \"kishikawakatsumi/KeychainAccess\" \"#{branch_name}\"' > Cartfile]
108+
sh %[carthage update --no-use-binaries]
99109
end
100110
end
101111

0 commit comments

Comments
 (0)