Skip to content

Commit 18e2440

Browse files
author
agilira
committed
new workflow, Makefile & codecov.yml
1 parent cfafba7 commit 18e2440

File tree

7 files changed

+180
-93
lines changed

7 files changed

+180
-93
lines changed

.codecov.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ comment:
1515

1616
ignore:
1717
- "**/*_test.go"
18-
- "demo/**"
19-
- "benchmarks/**"

.github/dependabot.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# AGILira Standard Dependabot Configuration
2+
# Copy this file to .github/dependabot.yml in your project root
3+
4+
version: 2
5+
updates:
6+
# Enable version updates for Go modules
7+
- package-ecosystem: "gomod"
8+
# Look for go.mod in the root directory
9+
directory: "/"
10+
# Check for updates daily
11+
schedule:
12+
interval: "daily"
13+
time: "09:00"
14+
timezone: "Europe/Rome"
15+
# Group updates to reduce PR noise
16+
groups:
17+
agilira:
18+
patterns:
19+
- "github.com/agilira/*"
20+
golang:
21+
patterns:
22+
- "golang.org/x/*"
23+
testing:
24+
patterns:
25+
- "github.com/stretchr/testify"
26+
- "github.com/go-test/*"
27+
# Auto-merge minor and patch updates for trusted dependencies
28+
open-pull-requests-limit: 5
29+
reviewers:
30+
- "agilira"
31+
assignees:
32+
- "agilira"
33+
commit-message:
34+
prefix: "[chore]"
35+
include: "scope"

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ jobs:
2020
- name: Setup Go
2121
uses: actions/setup-go@v5
2222
with:
23-
go-version: '1.21'
23+
go-version: 'stable'
2424
cache: true
2525

2626
- name: Install Dependencies
2727
run: |
2828
go install honnef.co/go/tools/cmd/staticcheck@latest
29-
go install github.com/mgechev/revive@latest
3029
go install github.com/securego/gosec/v2/cmd/gosec@latest
3130
3231
- name: Go Format Check
@@ -43,15 +42,12 @@ jobs:
4342
- name: Staticcheck
4443
run: staticcheck ./...
4544

46-
- name: Revive (Golint replacement)
47-
run: revive -config revive.toml ./... || true
48-
4945
- name: Security Scan (gosec)
5046
continue-on-error: true
5147
run: |
5248
echo "Running security scan..."
5349
gosec -conf .gosec.json ./... || true
54-
echo "Security scan completed"
50+
echo "Security scan completed"
5551
5652
- name: Test with Race Detection
5753
run: go test -race -timeout 5m -v ./...
@@ -72,11 +68,15 @@ jobs:
7268
build:
7369
name: Build Matrix
7470
runs-on: ${{ matrix.os }}
71+
continue-on-error: ${{ matrix.os == 'macos-latest' }}
7572
strategy:
7673
fail-fast: false
7774
matrix:
7875
os: [ubuntu-latest, windows-latest, macos-latest]
79-
go-version: ['1.21'] # Reduced to save minutes
76+
go-version: ['stable'] # Reduced to save minutes
77+
include:
78+
- os: macos-latest
79+
timeout: 5 # Shorter timeout for macOS due to runner availability issues
8080
steps:
8181
- name: Checkout
8282
uses: actions/checkout@v4
@@ -89,6 +89,8 @@ jobs:
8989

9090
- name: Build
9191
run: go build -v ./...
92+
timeout-minutes: ${{ matrix.timeout || 15 }}
9293

9394
- name: Short Test (no race, faster)
94-
run: go test -short -timeout 30s ./...
95+
run: go test -short -timeout 5m ./...
96+
timeout-minutes: ${{ matrix.timeout || 15 }}

.github/workflows/dependabot-auto-merge.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Go
1818
uses: actions/setup-go@v5
1919
with:
20-
go-version: '1.23'
20+
go-version: 'stable'
2121

2222
- name: Cache Go modules
2323
uses: actions/cache@v4
@@ -34,16 +34,6 @@ jobs:
3434
go mod download
3535
go test -v ./...
3636
37-
- name: Run benchmarks (quick)
38-
run: |
39-
if [ -d "benchmarks" ]; then
40-
cd benchmarks
41-
go mod download
42-
go test -bench=. -benchtime=1s
43-
else
44-
echo "No benchmarks directory found, skipping"
45-
fi
46-
4737
- name: Check if PR can be auto-merged
4838
id: auto-merge-check
4939
run: |
@@ -64,7 +54,7 @@ jobs:
6454
- name: Add comment for manual review
6555
if: steps.auto-merge-check.outputs.can_auto_merge == 'false'
6656
run: |
67-
gh pr comment "${{ github.event.pull_request.number }}" --body "🔍 **Manual Review Required**
57+
gh pr comment "${{ github.event.pull_request.number }}" --body "**Manual Review Required**
6858
6959
This appears to be a major version update that requires manual review.
7060
Please verify:

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: '1.23'
21+
go-version: 'stable'
2222
cache: true
2323

2424
- name: Quick Quality Check

.golangci.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

Makefile

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Go Makefile - AGILira Standard
2+
# Usage: make help
3+
4+
.PHONY: help test race fmt vet lint security check deps clean build install tools
5+
.DEFAULT_GOAL := help
6+
7+
# Variables
8+
BINARY_NAME := $(shell basename $(PWD))
9+
GO_FILES := $(shell find . -type f -name '*.go' -not -path './vendor/*')
10+
TOOLS_DIR := $(HOME)/go/bin
11+
12+
# Colors for output
13+
RED := \033[0;31m
14+
GREEN := \033[0;32m
15+
YELLOW := \033[1;33m
16+
BLUE := \033[0;34m
17+
NC := \033[0m # No Color
18+
19+
help: ## Show this help message
20+
@echo "$(BLUE)Available targets:$(NC)"
21+
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ { printf " $(GREEN)%-15s$(NC) %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
22+
23+
test: ## Run tests
24+
@echo "$(YELLOW)Running tests...$(NC)"
25+
go test -v ./...
26+
27+
race: ## Run tests with race detector
28+
@echo "$(YELLOW)Running tests with race detector...$(NC)"
29+
go test -race -v ./...
30+
31+
coverage: ## Run tests with coverage
32+
@echo "$(YELLOW)Running tests with coverage...$(NC)"
33+
go test -coverprofile=coverage.out ./...
34+
go tool cover -html=coverage.out -o coverage.html
35+
@echo "$(GREEN)Coverage report generated: coverage.html$(NC)"
36+
37+
fmt: ## Format Go code
38+
@echo "$(YELLOW)Formatting Go code...$(NC)"
39+
go fmt ./...
40+
41+
vet: ## Run go vet
42+
@echo "$(YELLOW)Running go vet...$(NC)"
43+
go vet ./...
44+
45+
staticcheck: ## Run staticcheck
46+
@echo "$(YELLOW)Running staticcheck...$(NC)"
47+
@if [ ! -f "$(TOOLS_DIR)/staticcheck" ]; then \
48+
echo "$(RED)staticcheck not found. Run 'make tools' to install.$(NC)"; \
49+
exit 1; \
50+
fi
51+
$(TOOLS_DIR)/staticcheck ./...
52+
53+
errcheck: ## Run errcheck
54+
@echo "$(YELLOW)Running errcheck...$(NC)"
55+
@if [ ! -f "$(TOOLS_DIR)/errcheck" ]; then \
56+
echo "$(RED)errcheck not found. Run 'make tools' to install.$(NC)"; \
57+
exit 1; \
58+
fi
59+
$(TOOLS_DIR)/errcheck ./...
60+
61+
gosec: ## Run gosec security scanner
62+
@echo "$(YELLOW)Running gosec security scanner...$(NC)"
63+
@if [ ! -f "$(TOOLS_DIR)/gosec" ]; then \
64+
echo "$(RED)gosec not found. Run 'make tools' to install.$(NC)"; \
65+
exit 1; \
66+
fi
67+
@$(TOOLS_DIR)/gosec ./... || (echo "$(YELLOW) gosec completed with warnings (may be import-related)$(NC)" && exit 0)
68+
69+
lint: staticcheck errcheck ## Run all linters
70+
@echo "$(GREEN)All linters completed.$(NC)"
71+
72+
security: gosec ## Run security checks
73+
@echo "$(GREEN)Security checks completed.$(NC)"
74+
75+
check: fmt vet lint security test ## Run all checks (format, vet, lint, security, test)
76+
@echo "$(GREEN)All checks passed!$(NC)"
77+
78+
check-race: fmt vet lint security race ## Run all checks including race detector
79+
@echo "$(GREEN)All checks with race detection passed!$(NC)"
80+
81+
tools: ## Install development tools
82+
@echo "$(YELLOW)Installing development tools...$(NC)"
83+
go install honnef.co/go/tools/cmd/staticcheck@latest
84+
go install github.com/kisielk/errcheck@latest
85+
go install github.com/securego/gosec/v2/cmd/gosec@latest
86+
@echo "$(GREEN)Tools installed successfully!$(NC)"
87+
88+
deps: ## Download and verify dependencies
89+
@echo "$(YELLOW)Downloading dependencies...$(NC)"
90+
go mod download
91+
go mod verify
92+
go mod tidy
93+
94+
clean: ## Clean build artifacts and test cache
95+
@echo "$(YELLOW)Cleaning...$(NC)"
96+
go clean
97+
go clean -testcache
98+
rm -f coverage.out coverage.html
99+
rm -f $(BINARY_NAME)
100+
101+
build: ## Build the binary
102+
@echo "$(YELLOW)Building $(BINARY_NAME)...$(NC)"
103+
go build -ldflags="-w -s" -o $(BINARY_NAME) .
104+
105+
install: ## Install the binary to $GOPATH/bin
106+
@echo "$(YELLOW)Installing $(BINARY_NAME)...$(NC)"
107+
go install .
108+
109+
bench: ## Run benchmarks
110+
@echo "$(YELLOW)Running benchmarks...$(NC)"
111+
go test -bench=. -benchmem ./...
112+
113+
ci: ## Run CI checks (used in GitHub Actions)
114+
@echo "$(BLUE)Running CI checks...$(NC)"
115+
@make fmt vet lint security test coverage
116+
@echo "$(GREEN)CI checks completed successfully!$(NC)"
117+
118+
dev: ## Quick development check (fast feedback loop)
119+
@echo "$(BLUE)Running development checks...$(NC)"
120+
@make fmt vet test
121+
@echo "$(GREEN)Development checks completed!$(NC)"
122+
123+
pre-commit: check ## Run pre-commit checks (alias for 'check')
124+
125+
all: clean tools deps check build ## Run everything from scratch
126+
127+
# Show tool status
128+
status: ## Show status of installed tools
129+
@echo "$(BLUE)Development tools status:$(NC)"
130+
@echo -n "staticcheck: "; [ -f "$(TOOLS_DIR)/staticcheck" ] && echo "$(GREEN)✓ installed$(NC)" || echo "$(RED)✗ missing$(NC)"
131+
@echo -n "errcheck: "; [ -f "$(TOOLS_DIR)/errcheck" ] && echo "$(GREEN)✓ installed$(NC)" || echo "$(RED)✗ missing$(NC)"
132+
@echo -n "gosec: "; [ -f "$(TOOLS_DIR)/gosec" ] && echo "$(GREEN)✓ installed$(NC)" || echo "$(RED)✗ missing$(NC)"

0 commit comments

Comments
 (0)