CI integration#

You can use Robocop in CI/CD from any provider using generated reports or output file.

If there is no direct support for the Robocop, you can raise an issue to add support for it (in our issue tracker) or implement your own solution.

One of the important configurations for CI integration is ‘return status’. See the docs.

GitHub Code Scanning#

You can integrate Robocop results with GitHub Code Scanning (GitHub documentation). It is possible to use SARIF (Static Analysis Results Interchange Format) output format. Example below shows GitHub Workflow that runs the Robocop with sarif report and uses produced file to upload results to GitHub Code Scanning:

robocop.yml#
name: Run Robocop

on:
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    # continue even if Robocop returns issues and fails step
    continue-on-error: true
    permissions:
      # required for issues to be recorded
      security-events: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install robotframework-robocop
      - name: Run robocop
        run: python -m robocop --reports sarif .
      - name: Upload SARIF file
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: .sarif.json
          category: robocop

The Robocop issues will be recorded in GitHub project:

Code Scanning in PR

Issue details:

Code Scanning issue details

You can configure Robocop using CLI or configuration file (Configuration).

GitLab pipeline#

There is some basic .gitlab-ci.yml file that triggers Robocop in GitLab CI/CD:

.gitlab-ci.yml#
image: python:3

robocop:
  before_script:
    - pip install -U robotframework-robocop
  script:
    - robocop

Jenkins#

There is no direct support for Robocop in Jenkins. But it is possible to use existing plugins for tools like pylint with Robocop output. You can start from generating Robocop output in the file (using -o / --output option). This file can be processed by Warnings Next Generation plugin to integrate Robocop results in your pipeline. More details can be found here.