DEV Community

Gabor Szabo
Gabor Szabo

Posted on • Originally published at code-maven.com

Day 4: GitHub Actions for Colombian Spanish.

Today I wanted to add GitHub Actions based Continuous Integration to a Ruby Gem, but after several failed attempts I went with Python.

Ruby failures

First I tried some Ruby gems I found on the Ruby Digger.

At first I tried the act-form Ruby gem, but got stuck on an error: wrong number of arguments (given 3, expected 1..2). I was not sure if the problem is in the code or my own setup, but for my experiments I am using an Ubuntu-based Docker container where I installed Ruby using apt-get. So unless the version of Ruby is incorrect I don't know what could be wrong on my side. I hope I'll get an answer to that. Even if it is that the author cannot reproduce the issue.

Then I tried ach_client written also in Ruby. There I got several types of errors: undefined method 'new' and ArgumentError: wrong number of arguments but I see some overlap. So now I started to worry. Maybe after all the problem is on my setup.

Python failures

Then I switched to Python and PyDigger.

The first I encountered was GalSim. As it turned out the GitHub link included in the distribution was incorrect and that's why PyDigger reported it as having GitHub link but not CI on GitHub. So I sent a Pull-Request fixing that.

Side note: Pydigger should Report when the URL provided as GitHub repo is invalid. (e.g. returns 404).

Same happened with flask-fs-router so here I also sent a
pull-request fixing that. Though in this case the author might want to go the other way and rename the repo instead. We'll see.

Then I looked at sphinx-console but the tests failed there. As I have not seen any instructions how to run the tests I was not sure if I am even running them correctly. So I opened an issue with it: How to run the tests? No module named 'sphinx_console'.

You might guess that at this point I was already quite exhausted and I have not even mentioned several other failed attempts where I could not even get to the point to have a reasonable issue to open.

However, I still have not added any CI to any project.

Adding GitHub Actions to col-spanish

Then I got lucky and bumped into the col-spanish project.

At first this too made me scratch my head as it came with a pyproject.toml file and it was using poetry, but then I realized this project does not have any dependencies so I could just install pytest and run with it. This is what I did and it was successful on first try. Here is the pull-request.

GitHub Actions configuration file

name: CI

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

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        runner: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ["3.9", "3.10", "3.11"]

    runs-on: ${{matrix.runner}}
    name: OS ${{matrix.runner}} Python ${{matrix.python-version}}

    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        # pip install -r requirements.txt
        pip install pytest

    - name: Check Python version
      run: python -V

    - name: Test with pytest
      run: pytest -vs
Enter fullscreen mode Exit fullscreen mode

Conclusion

Sometimes we have a lot of failed attempts till something works and on the way one can help improve other projects as well.

Top comments (0)