Robots: GitHub Actions

GitHub Action support is available in two different ways. There are some settings common to both:

  • Annotations will be used to mark problems in the files for those plug-ins that support this feature and if --linecomments has github as a configured bug system (the default).
  • Statuses will be added if the GitHub Token gives permission.

Workflow Action

The Apache Yetus community makes available a built-in action that may be executed as part of a standard GitHub Action workflow. The basic workflow file should look like this, changing [VERSION] to either be a released version (or main to use the bleeding edge, untested, and potentially unstable release):

---
name: Apache Yetus

on: [push, pull_request]  # yamllint disable-line rule:truthy

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: checkout
        uses: actions/checkout@v2
        with:
          path: src
          fetch-depth: 0
      - name: Apache Yetus test-patch
        uses: apache/yetus-test-patch-action@[VERSION]
        with:
          basedir: ./src
          patchdir: ./out
          buildtool: nobuild
          githubtoken: ${{ secrets.GITHUB_TOKEN }}
      - name: Artifact output
        if: ${{ always() }}
        uses: actions/upload-artifact@v2
        with:
          name: apacheyetuspatchdir
          path: ${{ github.workspace }}/out

Currently, not all arguments and parameters that can be set on the test-patch command line are available to set via the workflow action. Options currently supported are:

OptionNotesDefaultMore Information
basedirsame as --basedirNONEUsage Introduction
blankseolignorefilesame as --blanks-eol-ignore-file.yetus/blanks-eol.txtblanks plug-in
blankstabsignorefilesame as --blanks-tabs-ignore-file.yetus/blanks-tabs.txtblanks plug-in
bufbasedirsame as --buf-basedir.buf plug-in
buildtoolsame as --build-toolnobuildBuild Tools
continuousimprovementsame as --continuous-improvementtrueRobots
excludessame as --excludes.yetus/excludes.txtUsage Introduction
githubtokensame as --github-tokenNONEGitHub plug-in
javahomesame as --java-home/usr/lib/jvm/java-11-openjdk-amd64Java-related plug-ins
patchdirsame as --patch-dirNONEUsage Introduction
pipsame as --pylint-pippip3pylint plug-in
pluginssame as --pluginsall,-asflicense,-author,-findbugs,-gitlabcilint,-shelldocsUsage Introduction
projectsame as --projectAuto-set based upon the repository nameUsage Introduction
pylintsame as --pylintpylint3pylint plug-in
reapermodesame as --reapermodekillAdvanced Usage
reviveconfigsame as --revive-config.revive.tomlrevive plug-in

Items marked NONE MUST be provided in the workflow yaml file.

Some options are hard-coded to make test-patch easier to use:

ArgumentValueMore Information
--brief-report-filepatchdir/brief.txtbriefreport plug-in
--console-report-filepatchdir/console.txtQBT
--html-report-filepatchdir/report.htmlhtmlout plug-in
--junit-report-xmlpatchdir/junit-report.xmljunit plug-in
--pylint-requirementstruepylint plug-in

Manual Configuration

Manual configuration is recommended if one needs significant customization over the test environment and test-patch flags.

TRIGGER: ${GITHUB_ACTIONS}=True

GitHub Actions support has only been tested on the ubuntu-latest image. It automatically configures --patch-dir to be ${GITHUB_WORKSAPCE}/yetus if not previously set.

See also:

  • Apache Yetus' workflow action source for lower level details on the workflow action implementation.
  • Apache Yetus' source tree yetus.yaml for some tips and tricks.