Skip to content

Actions

GitHub stars GitHub forks License

Gamma GitHub actions for building and testing the various projects.

GitHub Repository Documentation Issues

Overview

  • 0 stars 0 forks 0 open issues

    License: MIT Category: Utilities

Installation

go get github.com/go-gamma/actions

Documentation

Reusable GitHub Actions workflows for Go projects in the go-gamma organization.

Available Workflows

Workflow Purpose
test.yml Run tests with race detection and Codecov coverage
lint.yml Comprehensive linting with golangci-lint v2
security.yml Security scanning with gosec and govulncheck
build.yml Cross-platform build verification
ci.yml Combined CI workflow (orchestrates all above)
release.yml Automated releases with changelog generation

Quick Start

Add this to your project's .github/workflows/ci.yml:

name: CI

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

jobs:
  ci:
    uses: go-gamma/actions/.github/workflows/ci.yml@v1
    with:
      go-version: '1.24'
    secrets:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Workflow Reference

test.yml

Run Go tests with race detection and coverage reporting.

jobs:
  test:
    uses: go-gamma/actions/.github/workflows/test.yml@v1
    with:
      go-version: '1.24'
      race-detection: true
      upload-coverage: true
    secrets:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Inputs:

Input Type Default Description
go-version string '1.24' Go version to use
go-version-file string '' Path to go.mod for version detection
working-directory string '.' Directory containing Go code
race-detection boolean true Enable race detector (-race flag)
test-flags string '-v -shuffle=on' Additional flags for go test
upload-coverage boolean true Upload coverage to Codecov

Secrets:

Secret Required Description
CODECOV_TOKEN No Codecov upload token (required for private repos)

lint.yml

Comprehensive linting with golangci-lint v2, including 50+ linters.

jobs:
  lint:
    uses: go-gamma/actions/.github/workflows/lint.yml@v1
    with:
      go-version: '1.24'
      only-new-issues: ${{ github.event_name == 'pull_request' }}

Inputs:

Input Type Default Description
go-version string '1.24' Go version to use
go-version-file string '' Path to go.mod for version detection
working-directory string '.' Directory containing Go code
golangci-lint-version string 'v2' golangci-lint version
config-path string '' Path to custom .golangci.yml
args string '' Additional golangci-lint arguments
only-new-issues boolean false Only report new issues (useful for PRs)

Enabled Linters:

The default configuration enables 50+ linters including: - govet, staticcheck, errcheck - Bug detection - gocyclo, gocognit, funlen - Complexity analysis - gosec - Security scanning - gofmt, goimports, revive - Code style - ineffassign, unused - Dead code detection

See .golangci.yml for the full configuration.


security.yml

Security analysis with gosec and govulncheck, with SARIF upload to GitHub Code Scanning.

jobs:
  security:
    uses: go-gamma/actions/.github/workflows/security.yml@v1
    with:
      go-version: '1.24'
      upload-sarif: true

Inputs:

Input Type Default Description
go-version string '1.24' Go version to use
go-version-file string '' Path to go.mod for version detection
working-directory string '.' Directory containing Go code
run-gosec boolean true Run gosec security scanner
run-govulncheck boolean true Run govulncheck vulnerability scanner
upload-sarif boolean true Upload SARIF to GitHub Code Scanning
fail-on-vulns boolean true Fail workflow if vulnerabilities found

build.yml

Cross-platform build verification across ubuntu, macos, and windows.

jobs:
  build:
    uses: go-gamma/actions/.github/workflows/build.yml@v1
    with:
      go-version: '1.24'
      platforms: 'ubuntu-latest,macos-latest,windows-latest'

Inputs:

Input Type Default Description
go-version string '1.24' Go version to use
go-version-file string '' Path to go.mod for version detection
working-directory string '.' Directory containing Go code
platforms string 'ubuntu-latest,macos-latest,windows-latest' Comma-separated list of runners
build-flags string '-v' Additional flags for go build
upload-artifacts boolean false Upload built binaries as artifacts

ci.yml

Combined CI workflow that orchestrates test, lint, security, and build workflows.

jobs:
  ci:
    uses: go-gamma/actions/.github/workflows/ci.yml@v1
    with:
      go-version: '1.24'
    secrets:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Job Execution Order:

flowchart TB
    subgraph parallel["Phase 1: Parallel"]
        test["test"]
        lint["lint"]
        security["security"]
    end

    subgraph sequential["Phase 2: Sequential"]
        build["build"]
    end

    test --> build
    lint --> build
    security --> build

Inputs:

Input Type Default Description
go-version string '1.24' Go version to use
go-version-file string '' Path to go.mod for version detection
working-directory string '.' Directory containing Go code
skip-lint boolean false Skip linting
skip-security boolean false Skip security scanning
skip-build boolean false Skip build matrix
platforms string 'ubuntu-latest,macos-latest,windows-latest' Build platforms

Secrets:

Secret Required Description
CODECOV_TOKEN No Codecov upload token

release.yml

Automated releases with changelog generation and GoDoc updates.

name: Release

on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  release:
    uses: go-gamma/actions/.github/workflows/release.yml@v1
    with:
      go-version: '1.24'
      generate-changelog: true

Inputs:

Input Type Default Description
go-version string '1.24' Go version to use
go-version-file string '' Path to go.mod for version detection
working-directory string '.' Directory containing Go code
generate-changelog boolean true Auto-generate changelog from commits
update-godoc boolean true Trigger pkg.go.dev to index new version
draft boolean false Create as draft release
prerelease boolean false Mark as prerelease
upload-artifacts boolean false Attach build artifacts to release

Versioning

We use semantic versioning for these workflows:

# Recommended: Major version (stable updates)
uses: go-gamma/actions/.github/workflows/ci.yml@v1

# Pinned: Specific version (strictest)
uses: go-gamma/actions/.github/workflows/ci.yml@v1.0.0

# Development only (unstable)
uses: go-gamma/actions/.github/workflows/ci.yml@main

Requirements

  • Go 1.24+
  • GitHub Actions enabled on your repository
  • For coverage: Codecov account (optional but recommended)
  • For security scanning: GitHub Advanced Security (for SARIF upload on private repos)

License

MIT License - see LICENSE for details.