From 9b32004ef4e824c92ae9afd38e8fd8024a344d78 Mon Sep 17 00:00:00 2001 From: Paul Mucur Date: Mon, 11 Sep 2023 11:57:19 +0100 Subject: [PATCH 1/2] Restore Ruby 2.5 support While trying to justify the restoration of Ruby 2.6 support by looking at the stats from RubyGems.org, it appears that the third most popular Ruby version is still 2.5. It's not clear why this is but if it is easy for us to add support, this means we cover the top five most used Ruby versions according to https://ui.honeycomb.io/ruby-together/datasets/rubygems.org/result/HBSqTboW1yi (with the bonus of supporting 2.6 due to it being the default system Ruby on macOS Monterey). --- .github/workflows/tests.yml | 25 ++++++++++++++----------- README.md | 4 ++-- Rakefile | 2 +- re2.gemspec | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6d0fd56..aff0075 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,7 @@ jobs: - '3.0' - '2.7' - '2.6' + - '2.5' libre2: - version: "20150501" soname: 0 @@ -74,8 +75,10 @@ jobs: fail-fast: false matrix: runs-on: ["ubuntu-latest", "macos-latest"] - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] include: + - ruby: "2.5" + runs-on: "windows-2019" - ruby: "2.6" runs-on: "windows-2019" - ruby: "2.7" @@ -122,7 +125,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -140,7 +143,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -158,7 +161,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0"] + ruby: ["2.5", "2.6", "2.7", "3.0"] runs-on: windows-latest steps: - uses: actions/checkout@v3 @@ -226,7 +229,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -247,7 +250,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -287,7 +290,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0"] + ruby: ["2.5", "2.6", "2.7", "3.0"] runs-on: windows-2019 steps: - uses: actions/checkout@v3 @@ -306,7 +309,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -327,7 +330,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -345,7 +348,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -363,7 +366,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest container: image: "ruby:${{matrix.ruby}}-alpine" diff --git a/README.md b/README.md index fe318fd..b4fffea 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A Ruby binding to [re2][], an "efficient, principled regular expression library". **Current version:** 2.0.0.beta1 -**Supported Ruby versions:** 2.7, 3.0, 3.1, 3.2 +**Supported Ruby versions:** 2.5, 2.6, 2.7, 3.0, 3.1, 3.2 **Bundled re2 version:** libre2.11 (2023-09-01) **Supported re2 versions:** libre2.0 (< 2020-03-02), libre2.1 (2020-03-02), libre2.6 (2020-03-03), libre2.7 (2020-05-01), libre2.8 (2020-07-06), libre2.9 (2020-11-01), libre2.10 (2022-12-01), libre2.11 (2023-07-01) @@ -16,7 +16,7 @@ The gem comes bundled with a version of [re2][] and will compile itself (and any dependencies) on install. As compilation can take a while, precompiled native gems are available for Linux, Windows and macOS. -In v2.0 and later, precompiled native gems are available for Ruby 2.7 to 3.2 +In v2.0 and later, precompiled native gems are available for Ruby 2.5 to 3.2 on these platforms: - `aarch64-linux` (requires: glibc >= 2.29) diff --git a/Rakefile b/Rakefile index 4712797..e1cefd8 100644 --- a/Rakefile +++ b/Rakefile @@ -33,7 +33,7 @@ Gem::PackageTask.new(RE2_GEM_SPEC) do |p| p.need_tar = false end -CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':') +CROSS_RUBY_VERSIONS = %w[3.2.0 3.1.0 3.0.0 2.7.0 2.6.0 2.5.0].join(':') CROSS_RUBY_PLATFORMS = %w[ aarch64-linux arm-linux diff --git a/re2.gemspec b/re2.gemspec index dd2d358..573920b 100644 --- a/re2.gemspec +++ b/re2.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.homepage = "https://github.com/mudge/re2" s.extensions = ["ext/re2/extconf.rb"] s.license = "BSD-3-Clause" - s.required_ruby_version = ">= 2.6.0" + s.required_ruby_version = ">= 2.5.0" s.files = [ ".rspec", "dependencies.yml", From e9c6ca477a45b651a1831b9fb4bc416ef089b4b6 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 11 Sep 2023 11:51:51 -0700 Subject: [PATCH 2/2] ci: Fix Ruby 2.5 in arm64 builds Standardize on using the Alpine Ruby base images since they tend to use a more recent version of glibc. Since Alpine images don't include `bash` and `gcompat` by default, add a wrapper (`scripts/test-gem-install-sh`) for Alpine. --- .github/workflows/tests.yml | 8 ++++---- scripts/test-gem-install-sh | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100755 scripts/test-gem-install-sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aff0075..1063de0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -242,8 +242,8 @@ jobs: - run: | docker run --rm -v "$(pwd):/re2" -w /re2 \ --platform=linux/arm64/v8 \ - ruby:${{matrix.ruby}} \ - ./scripts/test-gem-install ./gems + ruby:${{matrix.ruby}}-alpine \ + ./scripts/test-gem-install-sh ./gems test-precompiled-arm-linux: needs: ["build-precompiled-gems"] @@ -263,8 +263,8 @@ jobs: - run: | docker run --rm -v "$(pwd):/re2" -w /re2 \ --platform=linux/arm/v7 \ - ruby:${{matrix.ruby}} \ - ./scripts/test-gem-install ./gems + ruby:${{matrix.ruby}}-alpine \ + ./scripts/test-gem-install-sh ./gems test-precompiled-x64-mingw-ucrt: needs: ["build-precompiled-gems"] diff --git a/scripts/test-gem-install-sh b/scripts/test-gem-install-sh new file mode 100755 index 0000000..dcfc164 --- /dev/null +++ b/scripts/test-gem-install-sh @@ -0,0 +1,9 @@ +#! /usr/bin/env sh +# +# run as part of CI +# +if [ -f /etc/alpine-release ]; then + apk add bash gcompat +fi + +./scripts/test-gem-install $@