Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
flag

GitHub Action

TICS Code Quality Analysis

v3.0.1

TICS Code Quality Analysis

flag

TICS Code Quality Analysis

Analyze your code quality with TICS Client. Integrated quality gating allows for decorated pull request reviews

Installation

Copy and paste the following snippet into your .yml file.

              

- name: TICS Code Quality Analysis

uses: tiobe/[email protected]

Learn more about this action in tiobe/tics-github-action

Choose a version

TICS GitHub Action

Build Tests CodeQL

The TICS Github action integrates TICS Client analysis to measure your code quality. The incorporated Quality gating feature enables you to analyze and decorate pull requests.

Before you start

Prerequisites

  • A TICS Viewer (version 2022.4 or higher) running somewhere on the network that is HTTP(S) accessible by the runner on which you want to execute the action.

Action Restrictions

  • It is not working for forked repositories.
  • It is not working for TICS installations using the legacy deployment architecture.
  • macOS runners (GitHub-hosted or self-hosted) are not yet supported.
  • The connected runner should have Git installed.

Usage v3

Add the TICS GitHub Action to your workflow to launch TICS code analysis and post the results of Quality Gating feature as part of your pull request. Below are some example of how to include the TICS GitHub Action step as part of your workflow.

Client (default)

The default mode to run is TICS Client. In this mode the project can be either the project of the project to run or "project auto" (omit the project variable), in which mode TICS will figure out what project(s) are being run.

on: [pull_request]

jobs:
  TICS:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: TICS GitHub Action
        uses: tiobe/tics-github-action@v3
        with:
          project: project-name
          viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config
          ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
          installTics: true

QServer

As of v3 the option to do TICSQServer analyses has been available. In this mode the project has to be set and project "auto" is not available.

on: [pull_request]

jobs:
  TICS:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: TICS GitHub Action
        uses: tiobe/tics-github-action@v3
        with:
          mode: qserver
          project: project-name
          viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config
          ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
          installTics: true

Diagnostic

There is also the possibility to do a so called "diagnostic" run. This mode can be anabled to test if TICS has been setup properly and can run on the machine the action is run on.

on: [pull_request]

jobs:
  TICS:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: TICS GitHub Action
        uses: tiobe/tics-github-action@v3
        with:
          mode: diagnostic
          viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config
          ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
          installTics: true

Usage v2

Add the TICS GitHub Action to your workflow to launch TICS code analysis and post the results of Quality Gating feature as part of your pull request. Below is an example of how to include the TICS GitHub Action step as part of your workflow:

on: [pull_request]

jobs:
  TICS:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: TICS GitHub Action
        uses: tiobe/tics-github-action@v2
        with:
          projectName: project-name
          ticsConfiguration: https://domain.com/tiobeweb/TICS/api/cfg?name=config
          ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
          installTics: true

Supported Platforms

Linux and Windows based runners, both Github-hosted and self-hosted, are supported.

Recommended parameters

The following inputs are recommended or required for this action:

Input Description Required
viewerUrl A URL pointing to the "cfg" API endpoint of the TICS Viewer. It contains the name of the TICS Analyzer Configuration or "-" in case of the default configuration. true
mode Set the mode to run the action in. Options are client or qserver for an analysis run and diagnostic for a diagnostic run to test the setup. The default is client. false
project Name of the TICS project present in the TICS Viewer. If not given it will use project auto when running Client. Is required for QServer. false
ticsAuthToken Authentication token to authorize the plugin when it connects to the TICS Viewer. (Only required if a token is needed to run TICS.) false
installTics Boolean parameter to install TICS command-line tools on a runner before executing the analysis. If not specified, TICS should be installed manually on the machine that runs this job, default value is false. false

Optional parameters

Input Description Default Mode(s)
githubToken The action by Github automatically in an action (see Authenticating with the GITHUB_TOKEN), can be overridden if needed. GITHUB_TOKEN all
filelist Path to a file containing the files (newline separated) to run TICS for. This can be an absolute or relative (to workspace) path, and can also be . to analyze the whole project. This has to be set when the action is run outside of a pull request. - client
calc Comma-separated list of metrics to be used. The GATE metric is supported for TICS Viewer versions higher than 2022.2.x. GATE client, qserver
recalc Comma-separated list of metrics to be recalculated. The GATE GATE metric is supported for TICS Viewer versions higher than 2022.2.x. - client, qserver
cdtoken A custom client-data token for the purpose of the Client Viewer functionality. This provides a static URL that is updated with every analysis. - client
branchdir Root directory of the source files for the branch. - qserver
branchname Name of the branch in TICS. - client, qserver
codetype Allows you to pick which specific types of code you want to analyze with the TICS client. Options are PRODUCTION, TESTCODE and EXTERNAL. PRODUCTION client
excludeMovedFiles Exclude moved and renamed files from analysis completely. By default these are included if there are modifications in the file. false all
hostnameVerification Check whether the certificate matches the server. Options are 1/true or 0/false. Documentation on Client-side SSL/TLS. true all
trustStrategy Check the validity of certificates. Options are all, self-signed or strict. Documentation on Client-side SSL/TLS. strict all
postAnnotations Show the TICS violations in the changed files window. Options are true or false. true all
postToConversation Post the summary to the conversation page of the pull request. true all
pullRequestApproval Set the plugin to approve or deny a pull request, by default this is false. Options are true or false. Note that once a run that added a reviewer has been completed, this reviewer cannot be deleted from that pull request. (Always the case on versions between 2.0.0 and 2.5.0). false all
retryCodes Status codes to retry api calls for. The default codes will be overwritten if this option is set. 419, 500, 501, 502, 503, 504 all
secretsFilter Comma-seperated list of extra secrets to mask in the console output. - all
showBlockingAfter Show the blocking after violations in the changed files window. Options are true or false. true all
tmpdir Location to store debug information. - all
displayUrl The publicly available Viewer URL of TICS viewer to link the links in the review to. (e.g. https://domain.com/tiobeweb/TICS) - all