Skip to Content
Technical Articles

abaplint + github actions: brief set up summary

This blog post is a brief documentation on how to set up automatic abap code checking with abaplint and github actions.

Recently, I read the blog post below and I learned about abaplint for the first time. I thought it is a good tool and If you have a project on Github, it would be a shame not to use it.
https://blogs.sap.com/2020/02/01/running-abaplint-from-sci-atc-adt/

What is abaplint:
Abaplint is a tool written in javascript that analyzes ABAP code to flag programming errors, bugs, stylistic errors, and suspicious constructs. It will only do the “Code Inspector” part of checking the code. Abaplint runs outside the ABAP runtime environment.
More on this topic:
https://blogs.sap.com/2016/03/20/open-source-abap-tools-abaplint-and-abapcov/

What is github actions:
Github Actions is a way to automate, customize and execute your development workflows. You can write individual tasks, called actions, and combine them to create a custom workflow. Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.
More on this topic:
https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions

Link to the repository used in this post:
https://github.com/tobiaszgithub/abaplint-action-example

Now I will show you an example of how to create a repository and add actions to it.
You can create a new repository as in the example below or add a workflow to an existing repository.

Open the “Actions” tab.

 

Press the “set up this workflow” button and replace the visible code with the following:

name: CI

on: [push]

jobs:
  abaplint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: abaplint
      uses: abaplint/actions-abaplint@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The above workflow consists of two actions:

  • action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it
  • action execute abaplint on repository code and send the result back

 

You should now have a result similar to the one below. Don’t forget to commit changes.

 

Sample repository with file “README.md” and folder with workflows.

 

Create an online project in abapgit.

Add some code, programs or classes and push changes to github.

After a short while, in the “Actions” tab it is possible to see the result of the workflow execution:

In addition, if you don’t like any abaplint rules, you can add the abaplint.json file to the repository and activate / deactivate some rules in it.
On Our local machine, install abaplint globally and clone the repository:
$npm install abaplint -g
$ git clone https://github.com/tobiaszgithub/abaplint-action-example.git
$ cd abaplint-action-example
$ abaplint -d > abaplint.json
$ git status
$ git add .\abaplint.json
$ git commit -m “default abaplin.json added”
$ git push

Or we can take the sample abaplint.json file from the following repository:
https://github.com/FreHu/abaplint-clean-code

If we have defined workflow, we can use it to configure protected branches and required status checks. But this is a topic for another blog post.

As you can see, adding abaplint code checking to your github project is just a few clicks away.
I hope you find this useful for your development flow.

I was asked by a moderator to provide the source of the screenshots.
All screenshots in this post are made by me.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.