Skip to content

Commit ddf8d97

Browse files
committed
Unify the logic for Ruby <= 2.3 and the rest, always use ruby-build
1 parent 979bc88 commit ddf8d97

File tree

1 file changed

+21
-78
lines changed

1 file changed

+21
-78
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ jobs:
2323
- name: Check if already built
2424
run: '! curl -s --head --fail https://github.com/ruby/ruby-builder/releases/download/${{ steps.info.outputs.tag }}/${{ matrix.ruby }}-${{ matrix.os }}.tar.gz'
2525

26-
- name: Clone ruby-install
27-
run: git clone https://github.com/postmodern/ruby-install.git
28-
- name: Install ruby-install
29-
run: sudo make install
30-
working-directory: ./ruby-install
26+
# Ruby <= 2.3 needs OpenSSL 1.0.2 which cannot be installed on Ubuntu 16.04 and macos-latest.
27+
# To workaround that, we use a branch of ruby-build which builds its own OpenSSL.
28+
- name: Clone ruby-build (Ruby <= 2.3)
29+
run: git clone --branch ruby23-openssl-linux https://github.com/eregon/ruby-build.git
30+
if: startsWith(matrix.ruby, 'ruby-2.3') || startsWith(matrix.ruby, 'ruby-2.2') || startsWith(matrix.ruby, 'ruby-2.1')
31+
- name: Clone ruby-build
32+
run: git clone https://github.com/rbenv/ruby-build.git
33+
if: !(startsWith(matrix.ruby, 'ruby-2.3') || startsWith(matrix.ruby, 'ruby-2.2') || startsWith(matrix.ruby, 'ruby-2.1'))
34+
- name: Install ruby-build
35+
run: sudo ./ruby-build/install.sh
3136

3237
- name: List versions
33-
run: ruby-install
38+
run: ruby-build --definitions
3439

3540
# Install packages
3641
- run: sudo apt-get install -y --no-install-recommends libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev
@@ -40,9 +45,18 @@ jobs:
4045
run: sudo apt-get install -y --no-install-recommends ruby
4146
if: startsWith(matrix.os, 'ubuntu') && matrix.ruby == 'ruby-2.5.2'
4247

48+
- name: Set RUBY_BUILD_RUBY_NAME
49+
run: |
50+
ruby="${{ matrix.ruby }}"
51+
if [[ $ruby == ruby-* ]]; then
52+
echo "RUBY_BUILD_RUBY_NAME=${ruby#ruby-}" >> $GITHUB_ENV
53+
else
54+
echo "RUBY_BUILD_RUBY_NAME=$ruby" >> $GITHUB_ENV
55+
fi
4356
- name: Build Ruby
44-
run: ruby-install --prefix ~/build_prefix/${{ matrix.ruby }} --no-install-deps -j4 ${{ matrix.ruby }} -- --enable-shared --enable-rpath --enable-load-relative --disable-install-doc
57+
run: ruby-build --verbose $RUBY_BUILD_RUBY_NAME $HOME/build_prefix/${{ matrix.ruby }}
4558
env:
59+
RUBY_CONFIGURE_OPTS: --enable-shared --enable-rpath --enable-load-relative --disable-install-doc
4660
CPPFLAGS: "-DENABLE_PATH_CHECK=0" # https://github.com/actions/virtual-environments/issues/267
4761
- name: Fix the RubyGems line when using load-relative
4862
run: ~/build_prefix/${{ matrix.ruby }}/bin/ruby --disable-gems fix-rubygems-line.rb
@@ -158,74 +172,3 @@ jobs:
158172
asset_path: ${{ matrix.ruby }}-${{ matrix.os }}.tar.gz
159173
asset_name: ${{ matrix.ruby }}-${{ matrix.os }}.tar.gz
160174
asset_content_type: application/gzip
161-
162-
# Ruby <= 2.3 needs OpenSSL 1.0.2 which cannot be installed on Ubuntu 16.04 and macos-latest.
163-
# To workaround that, we use ruby-build which builds its own OpenSSL.
164-
build23:
165-
if: false
166-
strategy:
167-
fail-fast: false
168-
matrix:
169-
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest ]
170-
ruby-version: [ "2.1.9" ]
171-
# ruby-version: [ "2.2.10" ]
172-
# ruby-version: [ "2.3.0", "2.3.1", "2.3.2", "2.3.3", "2.3.4", "2.3.5", "2.3.6", "2.3.7", "2.3.8" ]
173-
runs-on: ${{ matrix.os }}
174-
steps:
175-
- uses: actions/checkout@v2
176-
- name: Set tag name
177-
id: info
178-
run: |
179-
tag=load-relative
180-
echo "::set-output name=tag::$tag"
181-
- name: Check if already built
182-
run: '! curl -s --head --fail https://github.com/ruby/ruby-builder/releases/download/${{ steps.info.outputs.tag }}/ruby-${{ matrix.ruby-version }}-${{ matrix.os }}.tar.gz'
183-
184-
- name: Clone ruby-build
185-
run: git clone --branch ruby23-openssl-linux https://github.com/eregon/ruby-build.git
186-
- name: Install ruby-build
187-
run: sudo ./ruby-build/install.sh
188-
189-
- name: List versions
190-
run: ruby-build --definitions
191-
192-
# Install packages
193-
- run: sudo apt-get install -y --no-install-recommends libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev
194-
if: startsWith(matrix.os, 'ubuntu')
195-
196-
- name: Build Ruby
197-
run: ruby-build --verbose ${{ matrix.ruby-version }} $HOME/build_prefix/ruby-${{ matrix.ruby-version }}
198-
env:
199-
RUBY_CONFIGURE_OPTS: --enable-shared --enable-rpath --enable-load-relative --disable-install-doc
200-
CPPFLAGS: "-DENABLE_PATH_CHECK=0" # https://github.com/actions/virtual-environments/issues/267
201-
- name: Fix the RubyGems line when using load-relative
202-
run: ~/build_prefix/ruby-${{ matrix.ruby-version }}/bin/ruby --disable-gems fix-rubygems-line.rb
203-
if: startsWith(matrix.ruby, 'ruby-')
204-
- name: Create archive
205-
run: tar czf ruby-${{ matrix.ruby-version }}-${{ matrix.os }}.tar.gz -C ~/build_prefix ruby-${{ matrix.ruby-version }}
206-
- name: Install Bundler if needed
207-
run: |
208-
if [ ! -e ~/build_prefix/ruby-${{ matrix.ruby-version }}/bin/bundle ]; then
209-
export PATH="$HOME/build_prefix/ruby-${{ matrix.ruby-version }}/bin:$PATH"
210-
gem install bundler -v '~> 1' --no-document
211-
fi
212-
213-
- run: echo "$HOME/build_prefix/ruby-${{ matrix.ruby-version }}/bin" >> $GITHUB_PATH
214-
- run: ruby --version
215-
- run: ruby -ropen-uri -e 'puts open("https://rubygems.org/") { |f| f.read(1024) }'
216-
- run: gem install json:2.2.0 --no-document
217-
- run: bundle --version
218-
- run: bundle install
219-
- run: bundle exec rake --version
220-
- run: ruby test_subprocess.rb
221-
222-
- name: Upload Built Ruby
223-
uses: actions/upload-release-asset@v1
224-
env:
225-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
226-
with:
227-
# curl -s "https://api.github.com/repos/ruby/ruby-builder/releases/tags/$TAG" | jq -r .upload_url
228-
upload_url: 'https://uploads.github.com/repos/ruby/ruby-builder/releases/33305698/assets{?name,label}'
229-
asset_path: ruby-${{ matrix.ruby-version }}-${{ matrix.os }}.tar.gz
230-
asset_name: ruby-${{ matrix.ruby-version }}-${{ matrix.os }}.tar.gz
231-
asset_content_type: application/gzip

0 commit comments

Comments
 (0)