Skip to content

Commit

Permalink
feat: add Ruby 3.2.5 support, make it default version
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Aug 14, 2024
1 parent a3b6038 commit 503d96a
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 40 deletions.
8 changes: 4 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@

test_task_template: &TEST_TASK_TEMPLATE
testset-1_script: |
RUBY_VER=3.1.6 tests/scripts/functional-tests.sh
RUBY_VER=3.2.5 tests/scripts/functional-tests.sh
testset-2_script: |
RUBY_VER=3.1.6 ruby tests-2/tebako-test.rb
RUBY_VER=3.2.5 ruby tests-2/tebako-test.rb
checkout-packed-mn_script: |
git clone https://github.com/metanorma/packed-mn.git packed-mn
package-metanorma_script: |
exe/tebako press -D --root=packed-mn --entry-point=bin/metanorma --output=metanorma-package -R 3.1.6
exe/tebako press -D --root=packed-mn --entry-point=bin/metanorma --output=metanorma-package -R 3.2.5
smoke-test_script: |
./metanorma-package help
Expand Down Expand Up @@ -107,7 +107,7 @@ task:
bundle install
bundle exec rake generate_version_txt
exe/tebako clean_ruby
exe/tebako setup -D -R 3.1.6
exe/tebako setup -D -R 3.2.5
upload_caches:
- tebako
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
env:
- { CC: gcc, CXX: g++, ALPINE_VER: "3.17" }
- { CC: clang, CXX: clang++, ALPINE_VER: "3.17" }
package_ruby_ver: [ '3.1.6', '3.2.4', '3.3.4' ]
package_ruby_ver: [ '3.1.6', '3.2.5', '3.3.4' ]
env: ${{ matrix.env }}
steps:
- name: Install packages
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Shall upload artifacts?
id: shall-upload
run: |
if [ "${{ matrix.package_ruby_ver }}" == "3.1.6" ] && [ "${{ matrix.env.CC }}" == "gcc" ]; then
if [ "${{ matrix.package_ruby_ver }}" == "3.2.5" ] && [ "${{ matrix.env.CC }}" == "gcc" ]; then
echo "upload=true" >> $GITHUB_OUTPUT
else
echo "upload=false" >> $GITHUB_OUTPUT
Expand All @@ -166,7 +166,7 @@ jobs:
env:
- { CC: gcc, CXX: g++, ALPINE_VER: "3.17" }
- { CC: clang, CXX: clang++, ALPINE_VER: "3.17" }
package_ruby_ver: [ '3.1.6', '3.2.4', '3.3.4' ]
package_ruby_ver: [ '3.1.6', '3.2.5', '3.3.4' ]
env: ${{ matrix.env }}
steps:
- name: Install packages
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/gem-test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
matrix:
os: [ 'windows-latest' ]
gem: [ fontist ]
package_ruby_ver: [ '3.1.6' ]
package_ruby_ver: [ '3.2.5' ]
env:
- { CC: gcc, CXX: g++ }
env: ${{ matrix.env }}
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
matrix:
os: [ 'alpine:3.17' ]
gem: [ metanorma, fontist ]
package_ruby_ver: [ '3.1.6' ]
package_ruby_ver: [ '3.2.5' ]
env:
- { CC: gcc, CXX: g++ }

Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
matrix:
os: [ macos-12, macos-14 ]
gem: [ metanorma, fontist ]
package_ruby_ver: [ '3.1.6' ]
package_ruby_ver: [ '3.2.5' ]
env:
- { CC: clang, CXX: clang++ }
env: ${{ matrix.env }}
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
matrix:
os: [ ubuntu-20.04 ]
gem: [ metanorma, fontist ]
package_ruby_ver: [ '3.1.6' ]
package_ruby_ver: [ '3.2.5' ]
env:
- { CC: clang-12, CXX: clang++-12 }
env: ${{ matrix.env }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- { os: macos-12, xcode: 13.1 }
- { os: macos-14, xcode: 14.3.1, LG_VADDR: 39 }
- { os: macos-14, xcode: 15.4 }
ruby_ver: ['3.1.6', '3.3.4']
ruby_ver: ['3.2.5', '3.3.4']
steps:
- name: Checkout tebako packaging environment
uses: actions/checkout@v4
Expand Down Expand Up @@ -100,8 +100,8 @@ jobs:
env:
- { os: macos-12, xcode: 13.1 }
- { os: macos-14, xcode: 14.3.1, LG_VADDR: 39}
package_ruby_ver: [ '3.1.6', '3.2.4' ]
ruby_ver: ['3.1.6']
package_ruby_ver: [ '3.2.5', '3.2.4' ]
ruby_ver: ['3.2.5']
include:
- { env: { os: macos-14, xcode: 15.4 }, ruby_ver: '3.3.4', package_ruby_ver: '3.3.4' }
steps:
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- name: Shall upload artifacts?
id: shall-upload
run: |
if [ "${{ matrix.package_ruby_ver }}" == "3.1.6" ] && [ "${{ matrix.ruby_ver }}" == "3.1.6" ] && [ "${{ matrix.env.os }}" == "macos-12" ]; then
if [ "${{ matrix.package_ruby_ver }}" == "3.2.5" ] && [ "${{ matrix.ruby_ver }}" == "3.2.5" ] && [ "${{ matrix.env.os }}" == "macos-12" ]; then
echo "upload=true" >> $GITHUB_OUTPUT
else
echo "upload=false" >> $GITHUB_OUTPUT
Expand All @@ -153,8 +153,8 @@ jobs:
env:
- { os: macos-12, xcode: 13.1 }
- { os: macos-14, xcode: 14.3.1, LG_VADDR: 39}
package_ruby_ver: [ '3.1.6', '3.2.4' ]
ruby_ver: ['3.1.6']
package_ruby_ver: [ '3.1.6', '3.2.5' ]
ruby_ver: ['3.2.5']
include:
- { env: { os: macos-14, xcode: 15.4 }, ruby_ver: '3.3.4', package_ruby_ver: '3.3.4' }
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
package_ruby_ver: [ '2.7.8', '3.0.7', '3.1.6', '3.2.4', '3.3.3', '3.3.4' ]
package_ruby_ver: [ '2.7.8', '3.0.7', '3.1.6', '3.2.4', '3.2.5', '3.3.3', '3.3.4' ]
env:
- { CC: gcc-10, CXX: g++-10 }
- { CC: clang-12, CXX: clang++-12 }
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
package_ruby_ver: [ '2.7.8', '3.0.7', '3.1.6', '3.2.4', '3.3.3', '3.3.4' ]
package_ruby_ver: [ '2.7.8', '3.0.7', '3.1.6', '3.2.4', '3.2.5', '3.3.3', '3.3.4' ]
env:
- { CC: gcc-10, CXX: g++-10 }
- { CC: clang-12, CXX: clang++-12 }
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-msys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
- sys: ucrt64
CC: gcc
CXX: g++
package_ruby_ver: [ '3.1.6', '3.2.4', '3.3.4' ]
package_ruby_ver: [ '3.1.6', '3.2.5', '3.3.4' ]
env: ${{ matrix.env }}

defaults:
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
- sys: ucrt64
CC: gcc
CXX: g++
package_ruby_ver: [ '3.1.6', '3.2.4', '3.3.4' ]
package_ruby_ver: [ '3.1.6', '3.2.5', '3.3.4' ]
env: ${{ matrix.env }}

defaults:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ tests-actions/
# rspec
.rspec_status
coverage/

# tebafile
.tebako.yml
2 changes: 1 addition & 1 deletion .tebako.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
options:
prefix: PWD
Ruby: 3.2.4
Ruby: 3.2.5
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ with debug information unstripped. You can opt to run 'strip -S' manually, it mo
| 2.7.8 | Linux, macOS
| 3.0.7 | Linux, macOS
| 3.1.6 | Linux, macOS, Windows
| 3.2.4 | Linux, macOS, Windows
| 3.2.{4,5} | Linux, macOS, Windows
| 3.3.{3,4} | Linux, macOS, Windows

|===
Expand Down
2 changes: 1 addition & 1 deletion common.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ BUILD_TYPE=Release
DEPS=deps
INCBIN_TAG=348e36b
DWARFS_WR_TAG=v0.5.8
RUBY_VER=3.1.6
RUBY_VER=3.2.5
2 changes: 1 addition & 1 deletion lib/tebako/cli_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def m_files
"MinGW Makefiles"
else
raise Tebako::Error.new(
"#{RUBY_PLATFORM} is not supported yet, exiting",
"#{RUBY_PLATFORM} is not supported, exiting",
254
)
end
Expand Down
10 changes: 6 additions & 4 deletions lib/tebako/cli_rubies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,27 @@ module CliRubies
"3.0.7" => "2a3411977f2850431136b0fab8ad53af09fb74df2ee2f4fb7f11b378fe034388",
"3.1.6" => "0d0dafb859e76763432571a3109d1537d976266be3083445651dc68deed25c22",
"3.2.4" => "c72b3c5c30482dca18b0f868c9075f3f47d8168eaf626d4e682ce5b59c858692",
"3.2.5" => "ef0610b498f60fb5cfd77b51adb3c10f4ca8ed9a17cb87c61e5bea314ac34a16",
"3.3.3" => "83c05b2177ee9c335b631b29b8c077b4770166d02fa527f3a9f6a40d13f3cce2",
"3.3.4" => "fe6a30f97d54e029768f2ddf4923699c416cdbc3a6e96db3e2d5716c7db96a34"
}.freeze

DEFAULT_RUBY_VERSION = "3.1.6"
MIN_RUBY_VERSION_WINDOWS = "3.1.6"
DEFAULT_RUBY_VERSION = "3.2.5"

def version_check(version)
return if RUBY_VERSIONS.key?(version)

raise Tebako::Error.new(
"Ruby version #{version} is not supported yet, exiting",
"Ruby version #{version} is not supported, exiting",
253
)
end

def version_check_msys(version)
if Gem::Version.new(version) < Gem::Version.new(DEFAULT_RUBY_VERSION) && RUBY_PLATFORM =~ /msys|mingw|cygwin/
if Gem::Version.new(version) < Gem::Version.new(MIN_RUBY_VERSION_WINDOWS) && RUBY_PLATFORM =~ /msys|mingw|cygwin/
raise Tebako::Error.new(
"Windows packaging works for Ruby #{DEFAULT_RUBY_VERSION} or above, version #{version} is not supported",
"Windows packaging works for Ruby #{MIN_RUBY_VERSION_WINDOWS} or above, version #{version} is not supported",
252
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tebako/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
# POSSIBILITY OF SUCH DAMAGE.

module Tebako
VERSION = "0.8.2"
VERSION = "0.8.3"
end
2 changes: 1 addition & 1 deletion spec/cli_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
end

it "raises a Tebako::Error" do
expect { m_files }.to raise_error(Tebako::Error, "unsupported is not supported yet, exiting")
expect { m_files }.to raise_error(Tebako::Error, "unsupported is not supported, exiting")
end
end
end
Expand Down
38 changes: 33 additions & 5 deletions spec/cli_rubies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,56 @@

require "tebako/cli_rubies"

RSpec.describe Tebako::CliRubies do
RSpec.describe Tebako::CliRubies do # rubocop:disable Metrics/BlockLength
include Tebako::CliRubies

describe "#version_check" do
context "when the Ruby version is supported" do
it "does not raise an error" do
expect { version_check("3.1.6") }.not_to raise_error
expect { version_check("3.2.5") }.not_to raise_error
end
end

context "when the Ruby version is not supported" do
it "raises a Tebako::Error" do
expect do
version_check("2.6.0")
end.to raise_error(Tebako::Error, "Ruby version 2.6.0 is not supported yet, exiting")
end.to raise_error(Tebako::Error, "Ruby version 2.6.0 is not supported, exiting")
end
end
end

describe "DEFAULT_RUBY_VERSION" do
it "is set to 3.1.6" do
expect(Tebako::CliRubies::DEFAULT_RUBY_VERSION).to eq("3.1.6")
it "is set to 3.2.5" do
expect(Tebako::CliRubies::DEFAULT_RUBY_VERSION).to eq("3.2.5")
end
end

describe "#version_check_msys" do
let(:min_ruby_version_windows) { Gem::Version.new(Tebako::CliRubies::MIN_RUBY_VERSION_WINDOWS) }

context "when version is below minimum on Windows" do
it "raises a Tebako::Error" do
version = "3.0.7"
stub_const("RUBY_PLATFORM", "msys")
expect { version_check_msys(version) }.to raise_error(Tebako::Error, /Windows packaging works for Ruby/)
end
end

context "when version is minimum on Windows" do
it "does not raise an error" do
version = "3.1.6"
stub_const("RUBY_PLATFORM", "msys")
expect { version_check_msys(version) }.not_to raise_error
end
end

context "when version is above minimum on Windows" do
it "does not raise an error" do
version = "3.2.5"
stub_const("RUBY_PLATFORM", "msys")
expect { version_check_msys(version) }.not_to raise_error
end
end
end
end
4 changes: 2 additions & 2 deletions spec/ruby_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
end
end

context "with version 3.2.0" do
let(:version) { Tebako::RubyVersion.new("3.2.0") }
context "with version 3.2.5" do
let(:version) { Tebako::RubyVersion.new("3.2.5") }

it "returns true for ruby3x?" do
expect(version.ruby3x?).to be true
Expand Down
2 changes: 1 addition & 1 deletion tests-2/tebako-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def pristine_env(*files)
end

def ruby_ver
ENV.fetch("RUBY_VER", "3.1.6")
ENV.fetch("RUBY_VER", "3.2.5")
end

def press_cmd(tebako, name, package, prefix, cwd = nil)
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/functional-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ DIR0=$( dirname "$0" )
DIR_ROOT=$( cd "$DIR0"/../.. && pwd )
DIR_BIN=$( cd "$DIR_ROOT"/exe && pwd )
DIR_TESTS=$( cd "$DIR_ROOT"/tests && pwd )
RUBY_VER=${RUBY_VER:-3.1.6}
RUBY_VER=${RUBY_VER:-3.2.5}

echo "Running tebako tests for Ruby $RUBY_VER"
# shellcheck source=/dev/null
Expand Down

0 comments on commit 503d96a

Please sign in to comment.