Skip to content

Commit 692adc6

Browse files
authored
Make the benchmarks group optional. (#1173)
It's for a contributor's smooth onboarding. This commit fixes the failed installation of the benchmarks group on Ruby >= 2.4 by the following error. ``` $ bundle install --without development ... Gem::Ext::BuildError: ERROR: Failed to build gem native extension. ... current directory: /opt/hostedtoolcache/Ruby/2.4.10/x64/lib/ruby/gems/2.4.0/gems/mysql-2.9.1/ext/mysql_api make "DESTDIR=" compiling mysql.c mysql.c: In function ‘stmt_bind_result’: mysql.c:1320:74: error: ‘rb_cFixnum’ undeclared (first use in this function); did you mean ‘rb_isalnum’? else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum) ^~~~~~~~~~ rb_isalnum ... ``` You can install the benchmarks group like this. ``` $ bundle install --with benchmarks ``` See https://bundler.io/man/gemfile.5.html#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS .
1 parent cab1d34 commit 692adc6

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
with:
5959
ruby-version: ${{ matrix.ruby }}
6060
- run: ruby -v
61-
- run: bundle install --without benchmarks development
61+
- run: bundle install --without development
6262
- if: matrix.db != ''
6363
run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
6464
- run: sudo echo "127.0.0.1 mysql2gem.example.com" | sudo tee -a /etc/hosts

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: required
22
dist: trusty
33
language: ruby
4-
bundler_args: --without benchmarks development
4+
bundler_args: --without development
55
# Pin Rubygems to a working version. Sometimes it breaks upstream. Update now and then.
66
before_install:
77
- gem --version

Gemfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ group :test do
1919
gem 'rubocop', '~> 0.50.0'
2020
end
2121

22-
group :benchmarks do
22+
group :benchmarks, optional: true do
2323
gem 'activerecord', '>= 3.0'
2424
gem 'benchmark-ips'
2525
gem 'do_mysql'
2626
gem 'faker'
27-
gem 'mysql'
27+
# The installation of the mysql latest version 2.9.1 fails on Ruby >= 2.4.
28+
gem 'mysql' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4')
2829
gem 'sequel'
2930
end
3031

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ install:
77
- ruby --version
88
- gem --version
99
- bundler --version
10-
- bundle install --without benchmarks --path vendor/bundle
10+
- bundle install --path vendor/bundle
1111
- IF DEFINED MINGW_PACKAGE_PREFIX (ridk exec pacman -S --noconfirm --needed %MINGW_PACKAGE_PREFIX%-libmariadbclient)
1212
build_script:
1313
- bundle exec rake compile

ci/container.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eux
44

55
ruby -v
6-
bundle install --path vendor/bundle --without benchmarks development
6+
bundle install --path vendor/bundle --without development
77

88
# Start mysqld service.
99
bash ci/setup_container.sh

0 commit comments

Comments
 (0)