Skip to content

baalimago/simple-go-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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/go.yml@v0.1.3
    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)

About

The simple go pipeline provides modular validation and test-coverage.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published