configuring-github-actions
GitHub Actions CI/CD Guide
Quick Reference
| Topic | Reference |
|---|---|
| E2E tests, containers, expect | testing-patterns.md |
| Permissions, secrets, security | security.md |
| Debugging, caching, performance | optimization.md |
Triggers: push, pull_request, release, workflow_dispatch, schedule
Runners: ubuntu-latest, macos-latest, macos-13, windows-latest
Contexts: ${{ github.event_name }}, ${{ github.ref }}, ${{ runner.os }}, ${{ matrix.* }}
Project Workflows
- installer-ci.yml: Build → test → E2E (matrix: ubuntu, debian, fedora, centos containers + macOS)
- release.yml: GoReleaser on version tags
Core Template
name: CI
on:
pull_request:
paths: ["component/**", ".github/workflows/ci.yml"]
push:
branches: [main]
paths: ["component/**"]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go build -v ./...
Essential Patterns
Concurrency Control
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
Permissions (least privilege)
permissions: {} # Top-level default
jobs:
build:
permissions:
contents: read # Job-level grants
Caching
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
Artifacts
- uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: dist/
retention-days: 1
if-no-files-found: error
- uses: actions/download-artifact@v4
with:
name: build-artifacts
path: dist/
Matrix Builds
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: ubuntu
- os: ubuntu-latest
platform: debian
container: debian:bookworm
- os: macos-latest
platform: macos
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
Common Actions
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: build --clean --snapshot
workdir: installer
More from mrpointer/dotfiles
configuring-zsh
Configure and troubleshoot Zsh shell. Use when editing .zshenv, .zprofile, .zshrc, .zlogin, or .zlogout, setting up powerlevel10k prompt, configuring oh-my-zsh or sheldon plugin manager, fixing PATH or environment variables, debugging slow shell startup, setting up completions/compinit/fpath, or working with zsh-autocomplete, zsh-autosuggestions, or zsh-syntax-highlighting plugins.
20managing-chezmoi
Manage dotfiles with chezmoi. Use when adding files to chezmoi, running chezmoi add/apply/diff/status, debugging why changes aren't appearing, working with chezmoi templates or .chezmoiignore, understanding source vs target files, resolving merge conflicts, or asking "how do I manage this file with chezmoi". For chezmoi command uncertainties, use Context7 to fetch latest docs.
2writing-go-tests
Write Go tests following project conventions. Use when creating test files, writing unit or integration tests, choosing mocks, or setting up test fixtures. Covers test naming, assertions, mock usage, table-driven patterns, and common pitfalls.
1writing-go-code
Apply Go coding standards when writing or modifying Go code. Use when implementing functions, using dependency injection, handling errors idiomatically, or working with interfaces. For test conventions, use the `writing-go-tests` skill instead.
1testing-go-code
Run Go unit tests, coverage reports, and benchmarks. Use when you need to run tests, check coverage, run benchmarks, or regenerate mocks after interface changes.
1linting-go-code
Lint and format Go code. Use when you need to run linters, fix lint errors, format code, or understand why a linter is complaining.
1