Skip to content

Commit

Permalink
Make the benchmarks group optional. (#1173)
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
junaruga authored Mar 15, 2021
1 parent cab1d34 commit 692adc6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
- run: ruby -v
- run: bundle install --without benchmarks development
- run: bundle install --without development
- if: matrix.db != ''
run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
- run: sudo echo "127.0.0.1 mysql2gem.example.com" | sudo tee -a /etc/hosts
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
dist: trusty
language: ruby
bundler_args: --without benchmarks development
bundler_args: --without development
# Pin Rubygems to a working version. Sometimes it breaks upstream. Update now and then.
before_install:
- gem --version
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ group :test do
gem 'rubocop', '~> 0.50.0'
end

group :benchmarks do
group :benchmarks, optional: true do
gem 'activerecord', '>= 3.0'
gem 'benchmark-ips'
gem 'do_mysql'
gem 'faker'
gem 'mysql'
# The installation of the mysql latest version 2.9.1 fails on Ruby >= 2.4.
gem 'mysql' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4')
gem 'sequel'
end

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ install:
- ruby --version
- gem --version
- bundler --version
- bundle install --without benchmarks --path vendor/bundle
- bundle install --path vendor/bundle
- IF DEFINED MINGW_PACKAGE_PREFIX (ridk exec pacman -S --noconfirm --needed %MINGW_PACKAGE_PREFIX%-libmariadbclient)
build_script:
- bundle exec rake compile
Expand Down
2 changes: 1 addition & 1 deletion ci/container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eux

ruby -v
bundle install --path vendor/bundle --without benchmarks development
bundle install --path vendor/bundle --without development

# Start mysqld service.
bash ci/setup_container.sh
Expand Down

0 comments on commit 692adc6

Please sign in to comment.