Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 818cc4e

Browse files
committed
Revamp Travis configuration files for automatic deployment
We now build against three darwin versions (Sierra, High Sierra and Catalina) to match Ruby core. We continue to build against 3 ruby versions on Linux, but we only deploy the ruby 2.7 builds (since they should all be identical).
1 parent 43902f0 commit 818cc4e

File tree

4 files changed

+36
-47
lines changed

4 files changed

+36
-47
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ lib/libv8/VERSION
1515
/release/**/.scaleway
1616
/vendor/.gclient
1717
/vendor/.gclient_entries
18+
/vendor/.cipd
1819
/vendor/v8/

.travis.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ rvm:
77
- 2.5
88
matrix:
99
include:
10-
- rvm: 2.6
11-
os: osx
12-
osx_image: xcode9.4.1
13-
fast_finish: true
10+
- os: osx
11+
osx_image: xcode12
12+
- os: osx
13+
osx_image: xcode11.3
14+
- os: osx
15+
osx_image: xcode10.1
1416
addons:
1517
apt:
1618
packages:
@@ -25,19 +27,21 @@ before_install:
2527
- if [ "$TRAVIS_OS_NAME" == "osx" -a "$TRAVIS_RUBY_VERSION" != "system" ]; then gem update bundler; fi
2628
script:
2729
- git submodule update --init
28-
- bundle exec rake spec binary --trace
30+
- bundle exec rake spec binary osx_varients --trace
2931
deploy:
3032
provider: releases
31-
file: $(git ls-files -o pkg | head -1)
33+
file_glob: true
34+
file: pkg/*.gem
3235
api_key:
3336
secure: OMCBceg89uRnU+FIPAPbeOK2pISvV4Cz62r9iTRIGXQCOOXX8M40i77/3DmtkMtc9FEuNyAu1+CH886PL2WtZZPK4CmEU3HuqXz1a5VsCI+zcAZL1tevKvblXOVQ3MG+B/SZRC3rEzGwjk4027WtzCCGoGCLUu4TFJP05+/8XN4=
3437
skip_cleanup: true
3538
on:
3639
tags: true
37-
# condition: $TRAVIS_OS_NAME = osx
40+
rvm: '2.7' # Only deploy 1 of each platform
3841
cache:
3942
bundler: true
4043
notifications:
4144
recipients:
4245
4346
47+

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ platforms.
2626
* x86_64-darwin-19
2727
* x86_64-darwin-18
2828
* x86_64-darwin-17
29-
* x86_64-darwin-16
30-
* x86_64-darwin-15
31-
* x86_64-darwin-14
3229
* x86_64-linux
3330
* x86-linux
3431

Rakefile

+24-37
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,20 @@ DISTRIBUTIONS = [
2020
module Helpers
2121
module_function
2222
def binary_gemspec(platform = Gem::Platform.local)
23-
gemspec = eval(File.read 'libv8.gemspec')
24-
gemspec.platform = platform
25-
gemspec
23+
eval(File.read 'libv8.gemspec').tap do |gemspec|
24+
gemspec.platform = platform
25+
gemspec.extensions.clear
26+
27+
# We don't need most things for the binary
28+
gemspec.files = []
29+
gemspec.files += ['lib/libv8.rb', 'lib/libv8/version.rb']
30+
gemspec.files += ['ext/libv8/location.rb', 'ext/libv8/paths.rb']
31+
gemspec.files += ['ext/libv8/.location.yml']
32+
33+
# V8
34+
gemspec.files += Dir['vendor/v8/include/**/*.h']
35+
gemspec.files += Dir['vendor/v8/out.gn/**/*.a']
36+
end
2637
end
2738

2839
def binary_gem_name(platform = Gem::Platform.local)
@@ -37,29 +48,14 @@ end
3748

3849
desc "build a binary gem #{Helpers.binary_gem_name}"
3950
task :binary => :compile do
40-
gemspec = Helpers.binary_gemspec
41-
gemspec.extensions.clear
42-
43-
# We don't need most things for the binary
44-
gemspec.files = []
45-
gemspec.files += ['lib/libv8.rb', 'lib/libv8/version.rb']
46-
gemspec.files += ['ext/libv8/location.rb', 'ext/libv8/paths.rb']
47-
gemspec.files += ['ext/libv8/.location.yml']
51+
require 'rubygems/package'
4852

49-
# V8
50-
gemspec.files += Dir['vendor/v8/include/**/*.h']
51-
gemspec.files += Dir['vendor/v8/out.gn/**/*.a']
53+
gemspec = Helpers.binary_gemspec
5254

5355
FileUtils.chmod 0644, gemspec.files
5456
FileUtils.mkdir_p 'pkg'
5557

56-
package = if Gem::VERSION < '2.0.0'
57-
Gem::Builder.new(gemspec).build
58-
else
59-
require 'rubygems/package'
60-
Gem::Package.build gemspec
61-
end
62-
58+
package = Gem::Package.build gemspec
6359
FileUtils.mv package, 'pkg'
6460
end
6561

@@ -110,22 +106,13 @@ end
110106
task :default => [:compile, :spec]
111107
task :build => [:clean]
112108

113-
task :repack, [:gemfile, :new_arch] do |t, args|
114-
dir = Dir::mktmpdir
115-
116-
begin
117-
sh "gem unpack #{args[:gemfile]} --target=#{dir}"
118-
sh "gem spec #{args[:gemfile]} --ruby > #{dir}/repack.gemspec"
119-
Dir.chdir(dir) do
120-
sh "sed -iorig 's/^ s.platform = .*$/ s.platform = \"#{args[:new_arch]}\".freeze/' repack.gemspec"
121-
Dir.chdir(Dir.glob("libv8-*/").first) do
122-
sh 'mv ../repack.gemspec ./'
123-
sh 'gem build repack.gemspec'
124-
end
125-
end
109+
desc 'Generate OSX varient platform names'
110+
task :osx_varients => [:compile] do
111+
gemspec = binary_gemspec
112+
return unless gemspec.platform == 'osx'
126113

127-
sh "mv #{dir}/*/*.gem ./pkg/"
128-
ensure
129-
FileUtils.remove_entry_secure dir
114+
%w(x86_64 universal).each do |cpu|
115+
gemspec.platform.cpu = cpu
116+
Gem::Package.build gemspec
130117
end
131118
end

0 commit comments

Comments
 (0)