Skip to content

Github Action to verify Go code with Gobra directly in a CI workflow

License

Notifications You must be signed in to change notification settings

viperproject/gobra-action

Repository files navigation

Gobra Action

This action adds Gobra to the CI Workflow of Go projects.

Usage

See action.yml

Examples

Simple set-up without caching

uses: viperproject/gobra-action@main
  with:
    caching: 0
    javaXss: 64m
    globalTimeout: 1h
    packageTimeout: 10m
    projectLocation: go

Set-up with caching

This configuration shows how to set-up the Gobra Action to store the verification results in ${{ runner.workspace }}/.gobra/cache.json. This file is loaded on subsequent runs of the Gobra Action and all cached verification results will not be re-computed.

- name: Cache Viper Server cache
  uses: actions/cache@v2
  env:
    cache-name: vs-cache
  with:
    path: ${{ runner.workspace }}/.gobra/cache.json 
    key: ${{ env.cache-name }}
- name: Verify all Gobra files
  uses: viperproject/gobra-action@main
  with:
    caching: 1
    viperBackend: VSWITHSILICON

Storing artifacts

There are two artifacts generated by this Action that are worth to be stored:

  • the cache file, generated in ${{ runner.workspace }}/.gobra/cache.json.
  • the statistics collected during verification, generated in ${{ runner.workspace }}/.gobra/stats.json.

The following snippet shows how to store these files as artifacts:

- name: Verify all Gobra files
  uses: viperproject/gobra-action@main
  with:
    caching: 1
    viperBackend: VSWITHSILICON
- name: Archive cache
  uses: actions/upload-artifact@v2
  with:
    name: cache
    path: ${{ runner.workspace }}/.gobra/cache.json
- name: Archive statistics report
  uses: actions/upload-artifact@v2
  with:
    name: stats
    path: ${{ runner.workspace }}/.gobra/stats.json     

License

The scripts and documentation in this project are released under the Mozilla Public License 2.0.