Skip to content

Commit

Permalink
Merge pull request #16294 from Bo98/ruby-3.1-minimum
Browse files Browse the repository at this point in the history
Require Ruby 3.1
  • Loading branch information
Bo98 authored Dec 11, 2023
2 parents 4395980 + 987ebe3 commit df97929
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 45 deletions.
27 changes: 4 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,6 @@ jobs:
- name: tests (macOS 13)
test-flags: --coverage
runs-on: macos-13
- name: tests (Ubuntu 22.04; Ruby 2.6)
runs-on: ubuntu-22.04
ruby: '2.6'
- name: tests (macOS 13; Ruby 2.6)
runs-on: macos-13
ruby: '2.6'
steps:
- name: Set up Homebrew
id: set-up-homebrew
Expand All @@ -313,21 +307,8 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ matrix.runs-on }}-tests-rubygems${{ matrix.ruby }}-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ matrix.runs-on }}-tests-rubygems${{ matrix.ruby }}-

- name: Setup Ruby
if: matrix.ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: none

- name: Setup Ruby environment
if: matrix.ruby
run: |
echo "HOMEBREW_USE_RUBY_FROM_PATH=1" >> "${GITHUB_ENV}"
rm -rf "${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew/vendor/portable-ruby"
key: ${{ matrix.runs-on }}-tests-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ matrix.runs-on }}-tests-rubygems-

- run: brew config

Expand All @@ -341,8 +322,8 @@ jobs:
uses: actions/cache@v3
with:
path: tests
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec${{ matrix.ruby }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec${{ matrix.ruby }}-
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-

- name: Install brew tests dependencies
if: matrix.name != 'tests (generic OS)'
Expand Down
3 changes: 0 additions & 3 deletions Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,6 @@ case "$*" in
;;
esac

# TODO: remove this after we want Dependabot to point to 3.1 minimum and system macOS Ruby code is gone
export HOMEBREW_RUBY3="1"

# TODO: bump version when new macOS is released or announced and update references in:
# - docs/Installation.md
# - https://github.com/Homebrew/install/blob/HEAD/install.sh
Expand Down
26 changes: 7 additions & 19 deletions Library/Homebrew/utils/ruby.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# When bumping, run `brew vendor-gems --update=--ruby`
# When bumping to a new major/minor version, also update the bounds in the Gemfile
export HOMEBREW_REQUIRED_RUBY_VERSION=2.6.10
export HOMEBREW_REQUIRED_RUBY_VERSION=3.1

# TODO: remove this after we want Dependabot to point to 3.1 minimum
export HOMEBREW_RUBY3="1"

# HOMEBREW_LIBRARY is from the user environment
# shellcheck disable=SC2154
Expand All @@ -10,24 +13,9 @@ test_ruby() {
return 1
fi

supported_ruby_versions=()
if [[ -n "${HOMEBREW_RUBY3}" && -z "${HOMEBREW_USE_RUBY_FROM_PATH}" ]]
then
supported_ruby_versions+=("3.1.0")
fi
supported_ruby_versions+=("${HOMEBREW_REQUIRED_RUBY_VERSION}")

for ruby_version in "${supported_ruby_versions[@]}"
do
if "$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt \
"${HOMEBREW_LIBRARY}/Homebrew/utils/ruby_check_version_script.rb" \
"${ruby_version}" 2>/dev/null
then
return 0
fi
done

return 1
"$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt \
"${HOMEBREW_LIBRARY}/Homebrew/utils/ruby_check_version_script.rb" \
"${HOMEBREW_REQUIRED_RUBY_VERSION}" 2>/dev/null
}

can_use_ruby_from_path() {
Expand Down

0 comments on commit df97929

Please sign in to comment.