Skip to content

Merge pull request #9026 from ruby/update-canonical-urls #12793

Merge pull request #9026 from ruby/update-canonical-urls

Merge pull request #9026 from ruby/update-canonical-urls #12793

name: install-rubygems
on:
pull_request:
push:
branches:
- master
concurrency:
group: ci-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
install_rubygems_ubuntu:
name: Install Rubygems on Ubuntu (${{ matrix.ruby.name }}, ${{ matrix.openssl.name }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ruby:
- { name: "3.2", value: 3.2.9 }
- { name: "3.3", value: 3.3.9 }
- { name: "3.4", value: 3.4.5 }
- { name: jruby, value: jruby-10.0.2.0 }
- { name: truffleruby, value: truffleruby-24.1.2 }
openssl:
- { name: openssl, value: true }
- { name: no-openssl, value: false }
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Setup ruby
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
with:
ruby-version: ${{ matrix.ruby.value }}
bundler: none
- name: Check successful install without warnings
run: |
ruby -Ilib -S rake install 2> errors.txt || (cat errors.txt && exit 1)
test ! -s errors.txt || (cat errors.txt && exit 1)
- name: Check downgrading
run: gem update --system 3.3.3
- name: Check installing fileutils
run: gem install fileutils
- name: Check installing with upgraded fileutils
run: |
ruby -Ilib -S rake install 2> errors.txt || (cat errors.txt && exit 1)
test ! -s errors.txt || (cat errors.txt && exit 1)
- name: Check generating documentation with a non default rdoc
run: |
gem install rdoc
gem rdoc rdoc | grep -q "Parsing documentation"
- name: Run a local rubygems command
run: gem list bundler
env:
RUBYOPT: -Itest/rubygems/fake_certlib
if: matrix.openssl.value == false
- name: Run a local rubygems command
run: gem list bundler
if: matrix.openssl.value == true
- name: Run a remote rubygems command
run: gem outdated
if: matrix.openssl.value == true
- name: Check commands in presence of a plugin that leaves unresolved dependencies print no warnings
run: |
gem install attempt:0.6.2 rspec:3.10.0 rspec:3.11.0
mkdir -p tmp/plugin-home
echo "require 'attempt'" > tmp/plugin-home/rubygems_plugin.rb
RUBYOPT=-Itmp/plugin-home gem env version 2> errors.txt || (cat errors.txt && exit 1)
test ! -s errors.txt || (cat errors.txt && exit 1)
RUBYOPT=-Itmp/plugin-home gem install sys-admin:1.8.1 2> errors.txt || (cat errors.txt && exit 1)
test ! -s errors.txt || (cat errors.txt && exit 1)
- name: Run bundler installed as a default gem
run: bundle --version
- name: Check bundler man pages were installed and are properly picked up
run: bundle install --help | grep -q BUNDLE-INSTALL
- name: Check bundler fallback man pages are properly picked up
run: sudo rm $(which man) && bundle install --help
- name: Install older bundler
run: gem install bundler:2.6.9
- name: Run older bundler without warnings
run: |
BUNDLER_VERSION=2.6.9 ruby -rbundler/setup -e1 2> errors.txt || (cat errors.txt && exit 1)
test ! -s errors.txt || (cat errors.txt && exit 1)
bundle _2.6.9_ -v 2> errors.txt || (cat errors.txt && exit 1)
test ! -s errors.txt || (cat errors.txt && exit 1)
- name: Build bundler
run: gem build bundler.gemspec
working-directory: ./bundler
- name: Install built bundler
run: gem install bundler-*.gem --verbose --backtrace > output.txt
working-directory: ./bundler
- name: Check bundler install didn't hit the network
run: if grep -q 'GET http' output.txt; then false; else true; fi
working-directory: ./bundler
- name: Check gem exec can create a rails project
run: gem exec rails new app --minimal
if: matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby'
- name: Check rails can be installed
run: gem install rails --verbose --backtrace
- name: Install and load a gem that defines a command as a plugin
run: |
gem install nexus:1.5.2
gem nexus --help
- name: Check gem exec preserves app name
run: gem exec kamal help | grep -q 'kamal help'
if: matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby'
timeout-minutes: 10
install_rubygems_windows:
name: Install Rubygems on Windows (${{ matrix.ruby.name }})
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
ruby:
- { name: "3.2", value: 3.2.9 }
- { name: "3.3", value: 3.3.9 }
- { name: "3.4", value: 3.4.5 }
- { name: jruby, value: jruby-10.0.2.0, rails-args: --skip-webpack-install }
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Setup ruby
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
with:
ruby-version: ${{ matrix.ruby.value }}
bundler: none
- name: Setup java
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 21.0.7
if: startsWith(matrix.ruby.name, 'jruby')
- name: Install rubygems
run: ruby setup.rb
shell: bash
- name: Check installation didn't modify any source controlled files
run: git add . && git diff --cached --exit-code
shell: bash
- name: Check we can install a Gemfile with git sources
run: bundle init && bundle add fileutils --git https://github.com/ruby/fileutils
shell: bash
- name: Generate a Rails application
run: gem install rails --version 8.0.1 && rails new foo ${{ matrix.ruby.rails-args }}
shell: bash
if: matrix.ruby.name != '3.1'
- name: Use gem installed in a bin dir different from where Ruby itself is installed
run: gem install rspec --version 3.13.0 --install-dir foo && GEM_HOME=foo foo/bin/rspec --version
shell: bash
timeout-minutes: 20
shared_gem_home:
name: Handling issues with a shared gem home
runs-on: ubuntu-24.04
strategy:
matrix:
rubygems:
- dev
- system
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Setup original ruby
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
with:
ruby-version: 3.2
bundler: none
- name: Save system RubyGems version to ENV
run: |
RGV=$(ruby -e 'puts Gem::VERSION.split(".")[0..2].join(".")')
echo "RGV=v$RGV" >> $GITHUB_ENV
if: matrix.rubygems == 'system'
- name: Set dev RubyGems version
run: |
RGV=..
echo "RGV=v$RGV" >> $GITHUB_ENV
if: matrix.rubygems == 'dev'
- name: Setup app depending on psych with initial Ruby
run: mkdir foo && cd foo && ../bundler/bin/bundle init && ../bundler/bin/bundle add psych -v 5.1.2
shell: bash
env:
GEM_HOME: bar
GEM_PATH: bar
- name: Setup final ruby
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
with:
ruby-version: 3.3
bundler: none
- name: Install gems with final ruby, using GEM_HOME created by the other Ruby
run: ../bundler/bin/bundle install
working-directory: foo
env:
GEM_HOME: bar
GEM_PATH: bar
timeout-minutes: 20
check_rvm_integration:
name: Handling gems shipped by default with RVM
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ruby:
- { name: "3.2", value: 3.2.9 }
- { name: "3.3", value: 3.3.9 }
- { name: "3.4", value: 3.4.5 }
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Setup ruby
uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0
with:
ruby-version: ${{ matrix.ruby.value }}
bundler: none
- name: Install rubygems
run: ruby setup.rb
- name: Install RVM gems
run: gem install rubygems-bundler
- name: Check binstubs can run
run: |
gem install rake
RUBYOPT=-Ibundler/lib rake -T
- name: Check binstubs can handle nested bundle exec
run: |
echo "source 'https://rubygems.org'" > Gemfile
gem install bundler:2.5.22
bundle _2.5.22_ exec ruby -e 'system("bundle", "exec", "ruby", "-e1")' 2>&1 | grep -v LoadError
all-pass:
name: All install-rubygems jobs pass
if: always()
needs:
- install_rubygems_ubuntu
- install_rubygems_windows
- shared_gem_home
- check_rvm_integration
runs-on: ubuntu-latest
steps:
- name: check dependent jobs
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}