Github CI, automate your code testing!

Testing... who likes it? Not many... But it has to be done, so lets do it automatically! And spend more time doing other stuff 😀

First, what is testing?

In its simplest form testing can be compiling. If it compiles, its ok. But this does not tell if its working as intended, so testing can also be to run specific simulated scenarios and check if the result is as expected.

To make it quickly a lot more challenging, how about it needs to compile without any warning? 😬

Besides this, tests can also be performed for spell checking, code formatting and basically everything you can think off!

Happy Code Tester


Running such tests automated with a well presented result, thats nice, or?

Here are multiple ways possible, and depending on what code language is used there are many different tools. In Python there is for example unittest for code and black for formatting, Arduino has arduino-lint and so on...  Then there are larger testing suites like lint. But how to run them?

For this i assume the project is on github, but also gitlab and other have such features.

So at what point should it run? How about at every git push? So every little change uploaded, to every branch, the automation will run.

Continuous Testing Actions

Thats the buzz word, Github has its infos here: Github Actions this is the tool to be used with Github.

A sample:

name: Spell Check

  - push
  - pull_request

    runs-on: ubuntu-latest

      - name: Checkout
        uses: actions/checkout@v3

      - name: Spell check
        uses: codespell-project/actions-codespell@master

Looks a bit strange or? Dont worry, its YAML...

To make it easier, how about a awesome curated list of Continuous Testing Actions.

This gives a introduction on what can be done and how to do it 😎


Comments powered by CComment