Skip to content

5. General recommendations

Edouard CHIN edited this page Feb 19, 2026 · 1 revision

Try to install the gems locally before publishing them

When the cibuildgem workflow is triggered, it uploads a tarball that includes the .gem files to GitHub artifacts. It's recommended to download the gem specific to your local platform and try to install it locally and run a irb session to require the gem. The .gem files are located inside the pkg folder in the tarball.

This will ensure that the binaries are not linked to a path that is specific to the GitHub machines that ran the compilation.

image

Define a test rake task that don't have a compilation prerequisite

Many gem with extensions have a test rake task that is very convenient during development and running rake test will first run the compilation before running the test, but this isn't ideal for cibuildgem. Cibuildgem runs the compilation on one machine and the test suite on another. Before running the test suite it copies the binaries. By defining a test rake task that runs the compilation, we waste resources but also don't ensure that the final binaries that will be packaged in the gem don't have issue.

You can solve this issue by using an environment variable to add task prerequisites.

# Rakefile

unless ENV['CIBUILDGEM']
  task(test: :compile)
end

Clone this wiki locally