Skip to content

add ARCHITECTURE.md #17

add ARCHITECTURE.md

add ARCHITECTURE.md #17

Workflow file for this run

name: PR Checks
on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.24']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Verify dependencies
run: go mod verify
- name: Build for current platform
run: make build
- name: Build for all supported platforms
run: make build-all
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: '1.24'
cache: true
- name: Run tests
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Generate coverage report
run: go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.out
coverage.html
- name: Check test coverage
run: |
coverage=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
echo "Total test coverage: ${coverage}%"
# Set minimum coverage threshold (can be adjusted)
threshold=30
if (( $(echo "$coverage < $threshold" | bc -l) )); then
echo "::warning::Test coverage ${coverage}% is below threshold ${threshold}%"
echo "Please consider adding more tests to improve coverage."
else
echo "✅ Test coverage ${coverage}% meets threshold ${threshold}%"
fi
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: '1.24'
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=5m
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
- name: Run Gosec Security Scanner
run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec -fmt=sarif -out=results.sarif -no-fail ./...
# Remove invalid fixes from SARIF to prevent upload errors
jq 'del(.runs[].results[].fixes)' results.sarif > results-clean.sarif
mv results-clean.sarif results.sarif
continue-on-error: true
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: results.sarif
category: gosec
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
- name: Check go fmt
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "❌ Go code is not formatted. Please run 'make fmt' or 'gofmt -s -w .'"
echo ""
echo "Unformatted files:"
gofmt -s -l .
exit 1
fi
echo "✅ All files are properly formatted"
- name: Check goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
if [ "$(goimports -l . | wc -l)" -gt 0 ]; then
echo "❌ Go imports are not properly formatted. Please run 'goimports -w .'"
echo ""
echo "Files with incorrect imports:"
goimports -l .
exit 1
fi
echo "✅ All imports are properly formatted"
- name: Check go vet
run: go vet ./...
- name: Check for common mistakes with staticcheck
uses: dominikh/staticcheck-action@v1
with:
version: "latest"
install-go: false
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
fail-on-severity: moderate