Skip to content

Install gem in Github Action with bundler-cache fails #172

@trombini77

Description

@trombini77

When is to install using in Github Actions with bundler cache like this:

      - name: Set Ruby version
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.2.2
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically

is not possible with the following error messages:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/gems/mimemagic-0.4.3/ext/mimemagic
/opt/hostedtoolcache/Ruby/3.2.2/x64/bin/ruby -rrubygems
/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/gems/rake-12.3.3/exe/rake
RUBYARCHDIR\=/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/mimemagic-0.4.3
RUBYLIBDIR\=/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/mimemagic-0.4.3
rake aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/gems/mimemagic-0.4.3/ext/mimemagic/Rakefile:28:in
`block in <top (required)>'
/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/gems/rake-12.3.3/exe/rake:27:in
`<main>'
Tasks: TOP => default
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in
/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/gems/mimemagic-0.4.3
for inspection.
Results logged to
/home/runner/work/card-processor-ms/card-processor-ms/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/mimemagic-0.4.3/gem_make.out

/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:119:in
`run'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/ext/rake_builder.rb:28:in
`build'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:187:in
`build_extension'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:221:in
`block in build_extensions'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in
`each'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/3.2.0/rubygems/installer.rb:843:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/source/rubygems.rb:201:in
`install'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:54:in
`install'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:156:in
`do_install'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:147:in
`block in worker_pool'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:62:in
`apply_func'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:57:in
`block in process_queue'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in
`loop'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in
`process_queue'
/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.14/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing mimemagic (0.4.3), and Bundler cannot
continue.

In Gemfile:
  mimemagic
Error: The process '/opt/hostedtoolcache/Ruby/3.2.2/x64/bin/bundle' failed with exit code 5

PS. the name card-processor-ms is the repository name where was the workflow was runned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions