Skip to content

Commit ce3c24f

Browse files
authored
Merge pull request #29 from spinel-coop/limit-setup-ruby
Only use setup-ruby if needed
2 parents 38b3493 + 374160e commit ce3c24f

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,25 @@ jobs:
3535

3636
- name: Get version for setup-ruby
3737
run: |
38-
VERSION=${{ inputs.formula }}
39-
VERSION=${VERSION//rv-ruby}
40-
VERSION=${VERSION//@}
41-
echo VERSION=${VERSION} >> $GITHUB_ENV
38+
SETUP_RUBY_VERSION=${{ inputs.formula }}
39+
SETUP_RUBY_VERSION=${SETUP_RUBY_VERSION//rv-ruby}
40+
SETUP_RUBY_VERSION=${SETUP_RUBY_VERSION//@}
41+
if [[ "$SETUP_RUBY_VERSION" == "3.2."* ]]; then
42+
echo SETUP_RUBY_VERSION=${SETUP_RUBY_VERSION} >> $GITHUB_ENV
43+
fi
4244
4345
# Static gem extensions typically require the same Ruby version available already
4446
- uses: ruby/setup-ruby@v1
4547
id: setup-ruby
46-
if: ${{ inputs.formula != 'rv-ruby@0.49' && inputs.formula != 'rv-ruby-dev' }}
48+
if: ${{ env.SETUP_RUBY_VERSION != '' }}
4749
with:
48-
ruby-version: ${{ env.VERSION }}
50+
ruby-version: ${{ env.SETUP_RUBY_VERSION }}
4951

5052
- name: Install Homebrew
5153
run: |
5254
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5355
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH
56+
echo "/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
5457
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
5558
5659
- name: Tap repo

Abstract/rv-ruby-32.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ def self.inherited(subclass)
7575
end
7676

7777
def install
78-
# share RUSTUP_HOME across installs if provided
79-
ENV["RUSTUP_HOME"] = ENV["HOMEBREW_RUSTUP_HOME"] if ENV.key?("HOMEBREW_RUSTUP_HOME")
80-
# provide rustc for YJIT compilation
81-
system "rustup install 1.58 --profile minimal" unless build.without? "yjit"
78+
if build.with? "yjit"
79+
# share RUSTUP_HOME across installs if provided
80+
ENV["RUSTUP_HOME"] = ENV["HOMEBREW_RUSTUP_HOME"] if ENV.key?("HOMEBREW_RUSTUP_HOME")
81+
ENV["RUSTUP_TOOLCHAIN"] = "1.58"
82+
system "rustup install 1.58 --profile minimal" unless system("which rustc")
83+
end
8284

8385
bundled_gems = File.foreach("gems/bundled_gems").reject do |line|
8486
line.blank? || line.start_with?("#")

Abstract/rv-ruby-33.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ def self.inherited(subclass)
7474
end
7575

7676
def install
77-
# share RUSTUP_HOME across installs if provided
78-
ENV["RUSTUP_HOME"] = ENV["HOMEBREW_RUSTUP_HOME"] if ENV.key?("HOMEBREW_RUSTUP_HOME")
79-
# provide rustc for YJIT compilation
80-
system "rustup install 1.58 --profile minimal" unless build.without? "yjit"
77+
if build.with? "yjit"
78+
# share RUSTUP_HOME across installs if provided
79+
ENV["RUSTUP_HOME"] = ENV["HOMEBREW_RUSTUP_HOME"] if ENV.key?("HOMEBREW_RUSTUP_HOME")
80+
ENV["RUSTUP_TOOLCHAIN"] = "1.58"
81+
system "rustup install 1.58 --profile minimal" unless system("which rustc")
82+
end
8183

8284
bundled_gems = File.foreach("gems/bundled_gems").reject do |line|
8385
line.blank? || line.start_with?("#")
@@ -108,8 +110,7 @@ def install
108110
if baseruby && baseruby_version =~ /#{Regexp.escape(version)}/
109111
args += %W[--with-baseruby=#{baseruby}]
110112
else
111-
odie "HOMEBREW_BASERUBY must contain the path to a ruby #{version} executable, " \
112-
"but instead contains #{baseruby}, with version #{baseruby_version}"
113+
args += %W[--with-baseruby=#{RbConfig.ruby}]
113114
end
114115
end
115116

Abstract/rv-ruby-34.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ def install
111111
if baseruby && baseruby_allowed
112112
args += %W[--with-baseruby=#{baseruby}]
113113
else
114-
odie "HOMEBREW_BASERUBY must contain the path to a ruby #{version} executable, " \
115-
"but instead contains #{baseruby}, with version #{baseruby_version}"
114+
args += %W[--with-baseruby=#{RbConfig.ruby}]
116115
end
117116

118117
args += %W[--enable-yjit] unless build.without? "yjit"

bin/package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ NUMBER="$1"
44

55
export HOMEBREW_RUSTUP_HOME="$HOME/.rustup"
66

7-
if [[ "0.49" != "$NUMBER" && "dev" != "$NUMBER" ]]; then
7+
if [[ "$NUMBER" == "3.2."* ]]; then
88
export HOMEBREW_BASERUBY="$HOME/.rubies/ruby-${NUMBER}/bin/ruby"
99
fi
1010

0 commit comments

Comments
 (0)