Skip to content

Latest commit

 

History

History
53 lines (40 loc) · 1.9 KB

README.md

File metadata and controls

53 lines (40 loc) · 1.9 KB

Simple Go Pipeline

The simple go pipeline provides modular validation and test-coverage. It has minimal amounts of dependencies, is fully customizable and gives test coverage in README.md without any third party websites.

Use it, or fork it and hack it!

Examples:

Test coverage printout

By default, it:

  • Builds the application
  • Checks that the code is adheres to staticcheck linting
  • Checks that the code is formated with gofumpt
  • Tests with -race flag

On exit code or similar failures, the pipeline will fail.

Usage

Create a file <github-repo>/.github/workflows/go.yml with this in it:

name: Simple Go Pipeline

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  call-workflow:
    uses: baalimago/simple-go-pipeline/.github/workflows/[email protected]
    with:
        test-readme-coverage: false

Done!

See here for the input variables you should change to enable/disable the different aspects of the validation. For example, jobs.call-workflow.with.staticcheck: false (in proper yml indention), would disable the staticcheck.

Test coverage readme

In order to get test coverage updated automatically updated into your readme, do like this:

  1. Carefully review your Gitlab Actions workflows, including this repo..!
  2. Go to https://github.com/<your-account>/<your-project>/settings/actions
  3. Set Workflow Permissions to Read and write perimssions
  4. Hit save
  5. Somewhere within your README.md, add the line Test coverage:
  6. Remove test-readme-coverage: false from your go.yml github actions workflow specification (it's true by default)