Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI

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

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Install dependencies
run: make tools

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.5.0 # Supports Go 1.25+
args: --timeout=5m

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Run tests
run: make test

- name: Generate coverage report
run: make test-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

verify:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Install dependencies
run: make tools

- name: Verify dependencies and formatting
run: make verify

# Commenting out example build since it requires generated code
# The example is for reference/documentation purposes
# build:
# name: Build Example
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version-file: 'go.mod'
# cache: true

all-checks:
name: All Checks Passed
needs: [lint, test, verify]
runs-on: ubuntu-latest
steps:
- name: All checks passed
run: echo "All CI checks passed successfully!"
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Run tests
run: make test

- name: Generate changelog
id: changelog
run: |
# Get the tag name
TAG=${GITHUB_REF#refs/tags/}

# Get previous tag
PREV_TAG=$(git describe --tags --abbrev=0 $TAG^ 2>/dev/null || echo "")

# Generate changelog
if [ -z "$PREV_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s (%h)" $TAG)
else
CHANGELOG=$(git log --pretty=format:"- %s (%h)" $PREV_TAG..$TAG)
fi

# Save changelog to file for multi-line handling
echo "$CHANGELOG" > changelog.txt

echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.changelog.outputs.tag }}
body_path: changelog.txt
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html

# Dependency directories (remove the comment below to include it)
# vendor/

.idea/
.trunk/
.vscode/
*.swp
*~
82 changes: 82 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: "2"
run:
tests: false
linters:
default: all
disable:
- containedctx
- copyloopvar
- cyclop
- err113
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert
- gochecknoglobals
- gochecknoinits
- gocognit
- godot
- godox
- gosec
- govet
- ireturn
- mnd
- nestif
- nlreturn
- noinlineerr
- nonamedreturns
- nosprintfhostport
- perfsprint
- prealloc
- tagliatelle
- varnamelen
- wrapcheck
- wsl
- wsl_v5
settings:
depguard:
rules:
main:
files:
- '!**/*_a _file.go'
deny:
- pkg: github.com/sirupsen/logrus
desc: not allowed
- pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package
errorlint:
comparison: false
funlen:
lines: 200
statements: 100
gosec:
excludes:
- G306
lll:
line-length: 120
nakedret:
max-func-lines: 35
tagalign:
align: false
sort: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- zz_generated.*
- third_party$
- builtin$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- zz_generated.*
- third_party$
- builtin$
Loading
Loading