Merge pull request #16241 from Bo98/ruby3-developers

Enable Ruby 3 for `HOMEBREW_DEVELOPER` and the Docker image
This commit is contained in:
Bo Anderson 2023-11-21 23:40:31 +00:00 committed by GitHub
commit 189d709c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 12 deletions

View File

@ -294,12 +294,12 @@ jobs:
- name: tests (macOS 13)
test-flags: --coverage
runs-on: macos-13
- name: tests (Ubuntu 22.04; Ruby 3.1)
- name: tests (Ubuntu 22.04; Ruby 2.6)
runs-on: ubuntu-22.04
ruby: '3.1'
- name: tests (macOS 13; Ruby 3.1)
ruby: '2.6'
- name: tests (macOS 13; Ruby 2.6)
runs-on: macos-13
ruby: '3.1'
ruby: '2.6'
steps:
- name: Set up Homebrew
id: set-up-homebrew
@ -321,6 +321,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: none
- name: Setup Ruby environment
if: matrix.ruby

View File

@ -55,7 +55,8 @@ RUN apt-get update \
USER linuxbrew
COPY --chown=linuxbrew:linuxbrew . /home/linuxbrew/.linuxbrew/Homebrew
ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}" \
HOMEBREW_RUBY3=1
WORKDIR /home/linuxbrew
RUN mkdir -p \

View File

@ -945,6 +945,11 @@ then
export HOMEBREW_SORBET_RUNTIME="1"
fi
if [[ -n "${HOMEBREW_DEVELOPER}" ]]
then
export HOMEBREW_RUBY3="1"
fi
if [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh" ]]
then
HOMEBREW_BASH_COMMAND="${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh"

View File

@ -10,16 +10,24 @@ test_ruby() {
return 1
fi
if [[ -n "${HOMEBREW_RUBY3}" ]]
supported_ruby_versions=()
if [[ -n "${HOMEBREW_RUBY3}" && -z "${HOMEBREW_USE_RUBY_FROM_PATH}" ]]
then
required_ruby_version="3.1.0"
else
required_ruby_version="${HOMEBREW_REQUIRED_RUBY_VERSION}"
supported_ruby_versions+=("3.1.0")
fi
supported_ruby_versions+=("${HOMEBREW_REQUIRED_RUBY_VERSION}")
"$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt \
"${HOMEBREW_LIBRARY}/Homebrew/utils/ruby_check_version_script.rb" \
"${required_ruby_version}" 2>/dev/null
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
}
can_use_ruby_from_path() {