DEV Community

Gabor Szabo
Gabor Szabo

Posted on • Originally published at code-maven.com

Day 21: CI for multi_string_replace Ruby Gem

multi_string_replace was one of the projects I started a yesterday and could not finish as there was an issue. I reported the issue and within a few hours the author pointed at a command I needed to include to make it work. Here is what happened:

I cloned the git repository and launched an Ubuntu 22.10-based Docker container I use to try these packages. Followed the instructions in the README file: Executed ./bin/setup and then ran rake spec. I got a nasty error message. As I saw already too many other Gems not working properly I did not investigate this one. Just reported it: rake spec failed: LoadError: cannot load such file -- multi_string_replace/multi_string_replace.

As I was looking at the README I also noticed that it has two links that are supposed to point to the GitHub repository, but there was a placeholder [USERNAME] instead of the actual username. I fixed that and sent a pull-request.

Soon the author accepted and integrated the PR and replied that I was missing the rake compile step.

Fair enough, but it was missing from the README as well. Probably because this README was a generated file and for pure-ruby Gems you don't need this extra step.

I tried it in my Docker container and it worked. I tried in GitHub Actions and it worked there too.

So I sent a pull-request adding this instruction to the README and then sent a pull-request adding GitHub Actions.

Both were accepted and integrated very quickly. I like this. Such quick action encourages contributors because their work starts to be useful very quickly. (even if that "work" is only fixing something in the README.)

GitHub Actions

The GitHub Actions configuration file can be seen here:

name: CI

on:
  push:
  pull_request:
  workflow_dispatch:
#  schedule:
#    - cron: '42 5 * * *'

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        ruby: [ '3.0' ]

    runs-on: ubuntu-latest
    name: Ruby ${{matrix.ruby}}
    container: ruby:${{matrix.ruby}}

    steps:
    - uses: actions/checkout@v3

    - name: Show ruby Version
      run: |
        ruby -v

    - name: Install Modules
      run: ./bin/setup

    - name: Compile
      run: rake compile

    - name: Run tests
      run: rake spec
Enter fullscreen mode Exit fullscreen mode

Conclusion

It is always a good idea to report the issues you encounter with software. Sometimes the author will react within a few hours and then you can make progress with whatever you were planning to do.

Top comments (0)