Back to Browse

Using GitHub Actions for Automated Ruby CI Testing (Let's Build a Ruby Gem, Ep 04)

679 views
Jun 17, 2021
22:36

In an effort to automatically run the test suite (RSpec and RuboCop) when pushing the gem code up to GitHub, I configured GitHub Actions, which was already set up from the `bundle gem` command. All it takes is adding a file named `.github/workflows/main.yml` to your project, and GitHub runs what is specified. Early in the episode, I learn that the Gemfile.lock should not be checked in, as per http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/. I remove it and CI starts running and working as expected. From there, I configure GitHub Actions to run the tests across multiple versions of Ruby to ensure the gem works on those various versions. Everything worked as expected and quite quickly except for the wildcard matching for patch versions of Ruby. I don't know if I did something wrong or if there's an issue with GitHub Actions. But it's not too difficult to specify an exact Ruby version. View the GitHub Actions config from this screencast: https://github.com/monoso/converty/blob/a185b63f62ddec99f36207b50d2737b82810df48/.github/workflows/main.yml More info about GitHub actions: https://github.com/features/actions https://docs.github.com/en/actions/guides/building-and-testing-ruby It'll be a bit different for various languages, but it was quick to get going with Ruby. It's free for public repos and has some free usage for private ones too. Other CI services I've used, which have all been nice and pretty similar: - Travis CI - Circle CI - Buildkite Software used in this screencast: Ruby version: 2.6.5 Bundler version: 2.2.16 Ruby Gem version: 3.0.6

Download

0 formats

No download links available.

Using GitHub Actions for Automated Ruby CI Testing (Let's Build a Ruby Gem, Ep 04) | NatokHD