Skip to content

Commit c539984

Browse files
committed
ci: modernize GitHub Actions workflows and enhance linting configuration
1 parent 5e6d532 commit c539984

50 files changed

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

0 commit comments

Comments
 (0)