Skip to content

Commit 8782045

Browse files
committed
ci: modernize GitHub Actions workflows and enhance linting configuration
1 parent b3048ce commit 8782045

50 files changed

Lines changed: 2445 additions & 612 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,90 @@
1-
# Basic set up for three package managers
1+
# Dependabot configuration for YAP
2+
# Documentation: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically
23

34
version: 2
5+
46
updates:
5-
# Maintain dependencies for GitHub Actions
7+
# GitHub Actions dependencies
68
- package-ecosystem: "github-actions"
79
directory: "/"
810
schedule:
911
interval: "weekly"
12+
day: "monday"
13+
time: "09:00"
14+
timezone: "UTC"
15+
open-pull-requests-limit: 5
16+
reviewers:
17+
- "M0Rf30"
18+
assignees:
19+
- "M0Rf30"
20+
labels:
21+
- "dependencies"
22+
- "github-actions"
23+
- "automated"
24+
commit-message:
25+
prefix: "chore(deps)"
26+
prefix-development: "chore(dev-deps)"
27+
include: "scope"
1028

11-
# Maintain dependencies for gradle
29+
# Go module dependencies
1230
- package-ecosystem: "gomod"
1331
directory: "/"
1432
schedule:
1533
interval: "weekly"
34+
day: "monday"
35+
time: "10:00"
36+
timezone: "UTC"
37+
open-pull-requests-limit: 10
38+
reviewers:
39+
- "M0Rf30"
40+
assignees:
41+
- "M0Rf30"
42+
labels:
43+
- "dependencies"
44+
- "go"
45+
- "automated"
46+
commit-message:
47+
prefix: "chore(deps)"
48+
prefix-development: "chore(dev-deps)"
49+
include: "scope"
50+
groups:
51+
# Group patch updates for better management
52+
patch-updates:
53+
applies-to: version-updates
54+
update-types:
55+
- "patch"
56+
# Group minor updates
57+
minor-updates:
58+
applies-to: version-updates
59+
update-types:
60+
- "minor"
61+
ignore:
62+
# Ignore specific packages that may cause issues
63+
- dependency-name: "golang.org/x/sys"
64+
update-types: ["version-update:semver-major"]
65+
- dependency-name: "golang.org/x/net"
66+
update-types: ["version-update:semver-major"]
67+
# Example: Ignore major version updates for specific critical dependencies
68+
# - dependency-name: "github.com/spf13/cobra"
69+
# update-types: ["version-update:semver-major"]
70+
71+
# Docker dependencies (if Dockerfiles contain FROM instructions)
72+
- package-ecosystem: "docker"
73+
directory: "/build/deploy"
74+
schedule:
75+
interval: "weekly"
76+
day: "tuesday"
77+
time: "09:00"
78+
timezone: "UTC"
79+
open-pull-requests-limit: 3
80+
reviewers:
81+
- "M0Rf30"
82+
assignees:
83+
- "M0Rf30"
84+
labels:
85+
- "dependencies"
86+
- "docker"
87+
- "automated"
88+
commit-message:
89+
prefix: "chore(docker)"
90+
include: "scope"

.github/workflows/ci.yml

Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
name: 🔄 Continuous Integration
2+
3+
on:
4+
push:
5+
branches: ["main", "codebase-improvements"]
6+
paths-ignore:
7+
- "docs/**"
8+
- "*.md"
9+
- ".gitignore"
10+
pull_request:
11+
branches: ["main", "codebase-improvements"]
12+
paths-ignore:
13+
- "docs/**"
14+
- "*.md"
15+
- ".gitignore"
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
env:
22+
GO_VERSION: "1.24"
23+
24+
jobs:
25+
# ===================================
26+
# Code Quality & Linting
27+
# ===================================
28+
quality:
29+
name: 🔍 Code Quality
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 10
32+
33+
steps:
34+
- name: 📂 Checkout code
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: 🐹 Set up Go
40+
uses: actions/setup-go@v5
41+
with:
42+
go-version: ${{ env.GO_VERSION }}
43+
cache: true
44+
45+
- name: 📥 Download dependencies
46+
run: go mod download
47+
48+
- name: 🧹 Run gofmt
49+
run: |
50+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
51+
echo "❌ Code is not formatted:"
52+
gofmt -s -l .
53+
exit 1
54+
fi
55+
echo "✅ Code is properly formatted"
56+
57+
- name: 🔍 Run go vet
58+
run: go vet ./...
59+
60+
- name: 📊 Run golangci-lint
61+
uses: golangci/golangci-lint-action@v8
62+
with:
63+
version: latest
64+
65+
# ===================================
66+
# Security Scanning
67+
# ===================================
68+
security:
69+
name: 🔒 Security Scan
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 10
72+
73+
steps:
74+
- name: 📂 Checkout code
75+
uses: actions/checkout@v4
76+
with:
77+
fetch-depth: 0
78+
79+
- name: 🐹 Set up Go
80+
uses: actions/setup-go@v5
81+
with:
82+
go-version: ${{ env.GO_VERSION }}
83+
cache: true
84+
85+
- name: 🔒 Install Gosec
86+
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
87+
88+
- name: 🔒 Run Gosec Security Scanner
89+
run: |
90+
gosec -fmt sarif -out gosec.sarif ./...
91+
92+
- name: 📋 Upload SARIF file
93+
uses: github/codeql-action/upload-sarif@v3
94+
with:
95+
sarif_file: gosec.sarif
96+
97+
# ===================================
98+
# Build & Test Matrix
99+
# ===================================
100+
test:
101+
name: 🧪 Test
102+
runs-on: ${{ matrix.os }}
103+
timeout-minutes: 15
104+
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
os: [ubuntu-latest, macos-latest, windows-latest]
109+
go-version: ["1.23", "1.24"]
110+
111+
steps:
112+
- name: 📂 Checkout code
113+
uses: actions/checkout@v4
114+
with:
115+
fetch-depth: 0
116+
117+
- name: 🐹 Set up Go ${{ matrix.go-version }}
118+
uses: actions/setup-go@v5
119+
with:
120+
go-version: ${{ matrix.go-version }}
121+
cache: true
122+
123+
- name: 📥 Download dependencies
124+
run: go mod download
125+
126+
- name: ✅ Verify dependencies
127+
run: go mod verify
128+
129+
- name: 🔨 Build project
130+
run: go build -v ./...
131+
132+
- name: 🧪 Run tests
133+
run: go test -v -race -coverprofile=coverage.out ./...
134+
135+
- name: 📊 Upload coverage to Codecov
136+
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24'
137+
uses: codecov/codecov-action@v4
138+
with:
139+
file: ./coverage.out
140+
flags: unittests
141+
name: codecov-umbrella
142+
fail_ci_if_error: false
143+
144+
# ===================================
145+
# Build Validation
146+
# ===================================
147+
build:
148+
name: 🔨 Build Validation
149+
runs-on: ubuntu-latest
150+
timeout-minutes: 15
151+
needs: [quality, security]
152+
153+
steps:
154+
- name: 📂 Checkout code
155+
uses: actions/checkout@v4
156+
with:
157+
fetch-depth: 0
158+
159+
- name: 🐹 Set up Go
160+
uses: actions/setup-go@v5
161+
with:
162+
go-version: ${{ env.GO_VERSION }}
163+
cache: true
164+
165+
- name: 📥 Download dependencies
166+
run: go mod download
167+
168+
- name: 🔨 Build for multiple architectures
169+
run: |
170+
# Linux
171+
GOOS=linux GOARCH=amd64 go build -o dist/yap-linux-amd64 ./cmd/yap
172+
GOOS=linux GOARCH=arm64 go build -o dist/yap-linux-arm64 ./cmd/yap
173+
174+
# macOS
175+
GOOS=darwin GOARCH=amd64 go build -o dist/yap-darwin-amd64 ./cmd/yap
176+
GOOS=darwin GOARCH=arm64 go build -o dist/yap-darwin-arm64 ./cmd/yap
177+
178+
# Windows
179+
GOOS=windows GOARCH=amd64 go build -o dist/yap-windows-amd64.exe ./cmd/yap
180+
181+
echo "✅ Multi-architecture build successful"
182+
183+
- name: 🧪 Test built binaries
184+
run: |
185+
./dist/yap-linux-amd64 version
186+
echo "✅ Binary execution test passed"
187+
188+
- name: 📦 Upload build artifacts
189+
uses: actions/upload-artifact@v4
190+
with:
191+
name: build-artifacts
192+
path: dist/
193+
retention-days: 7
194+
195+
# ===================================
196+
# Integration Tests
197+
# ===================================
198+
integration:
199+
name: 🔗 Integration Tests
200+
runs-on: ubuntu-latest
201+
timeout-minutes: 20
202+
needs: [build]
203+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
204+
205+
services:
206+
docker:
207+
image: docker:dind
208+
options: --privileged
209+
210+
steps:
211+
- name: 📂 Checkout code
212+
uses: actions/checkout@v4
213+
with:
214+
fetch-depth: 0
215+
216+
- name: 🐹 Set up Go
217+
uses: actions/setup-go@v5
218+
with:
219+
go-version: ${{ env.GO_VERSION }}
220+
cache: true
221+
222+
- name: 🐳 Set up Docker Buildx
223+
uses: docker/setup-buildx-action@v3
224+
225+
- name: 📥 Download build artifacts
226+
uses: actions/download-artifact@v4
227+
with:
228+
name: build-artifacts
229+
path: dist/
230+
231+
- name: 🔧 Make binaries executable
232+
run: chmod +x dist/*
233+
234+
- name: 🧪 Run integration tests
235+
run: |
236+
# Test example PKGBUILD if available
237+
if [ -f examples/yap/PKGBUILD ]; then
238+
echo "🧪 Testing example build..."
239+
cd examples/yap
240+
timeout 300 ../../dist/yap-linux-amd64 build . || echo "⚠️ Integration test completed with warnings"
241+
cd ../..
242+
fi
243+
244+
# ===================================
245+
# Documentation Generation
246+
# ===================================
247+
docs:
248+
name: 📚 Documentation
249+
runs-on: ubuntu-latest
250+
timeout-minutes: 10
251+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
252+
253+
steps:
254+
- name: 📂 Checkout code
255+
uses: actions/checkout@v4
256+
with:
257+
fetch-depth: 0
258+
259+
- name: 🐹 Set up Go
260+
uses: actions/setup-go@v5
261+
with:
262+
go-version: ${{ env.GO_VERSION }}
263+
cache: true
264+
265+
- name: 📚 Generate documentation
266+
run: |
267+
make doc-deps
268+
make doc-generate
269+
270+
- name: 📤 Upload documentation artifacts
271+
uses: actions/upload-artifact@v4
272+
with:
273+
name: documentation
274+
path: docs/api/
275+
retention-days: 30
276+
277+
# ===================================
278+
# Summary Job
279+
# ===================================
280+
ci-success:
281+
name: ✅ CI Success
282+
runs-on: ubuntu-latest
283+
needs: [quality, security, test, build, integration, docs]
284+
if: always()
285+
286+
steps:
287+
- name: 🎉 All jobs completed
288+
run: |
289+
if [[ "${{ needs.quality.result }}" == "success" && \
290+
"${{ needs.security.result }}" == "success" && \
291+
"${{ needs.test.result }}" == "success" && \
292+
"${{ needs.build.result }}" == "success" && \
293+
("${{ needs.integration.result }}" == "success" || "${{ needs.integration.result }}" == "skipped") && \
294+
("${{ needs.docs.result }}" == "success" || "${{ needs.docs.result }}" == "skipped") ]]; then
295+
echo "🎉 All CI jobs completed successfully!"
296+
exit 0
297+
else
298+
echo "❌ Some CI jobs failed"
299+
exit 1
300+
fi

0 commit comments

Comments
 (0)