Skip to content

Commit 4a74db5

Browse files
author
TeleGhost Dev
committed
ci: add PR verification mechanism (lint, tests, gosec, trufflehog)
1 parent 70a16ca commit 4a74db5

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

.github/workflows/verify_pr.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Pull Request Verification
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
# --- backend: Go Checks ---
11+
backend-checks:
12+
name: Backend (Go)
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.24'
22+
cache: true
23+
24+
- name: Go Format Check
25+
run: |
26+
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
27+
echo "The following files are not formatted:"
28+
gofmt -l .
29+
exit 1
30+
fi
31+
32+
- name: Run golangci-lint
33+
uses: golangci/golangci-lint-action@v6
34+
with:
35+
version: latest
36+
args: --timeout=5m
37+
38+
- name: Security Scan (gosec)
39+
uses: securego/gosec@master
40+
with:
41+
args: ./...
42+
43+
- name: Run Tests
44+
run: go test -v -short ./...
45+
46+
# --- frontend: Web Checks ---
47+
frontend-checks:
48+
name: Frontend (Svelte)
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: '20'
58+
cache: 'npm'
59+
cache-dependency-path: frontend/package-lock.json
60+
61+
- name: Install Dependencies
62+
run: |
63+
cd frontend
64+
npm ci
65+
66+
- name: Build Check
67+
run: |
68+
cd frontend
69+
npm run build
70+
71+
# --- security: Secrets Scan ---
72+
secrets-scan:
73+
name: Secrets Scan
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0
80+
- name: Secret Scanning
81+
uses: trufflesecurity/trufflehog@main
82+
with:
83+
extra_args: --only-verified

.golangci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
linters-settings:
2+
govet:
3+
check-shadowing: true
4+
golint:
5+
min-confidence: 0.8
6+
gocyclo:
7+
min-complexity: 15
8+
maligned:
9+
suggest-new: true
10+
dupl:
11+
threshold: 100
12+
goconst:
13+
min-len: 3
14+
min-occurrences: 3
15+
misspell:
16+
locale: US
17+
lll:
18+
line-length: 140
19+
goimports:
20+
local-prefixes: github.com/kiktor12358/TeleGhost
21+
22+
linters:
23+
enable:
24+
- govet
25+
- errcheck
26+
- staticcheck
27+
- unused
28+
- gosimple
29+
- structcheck
30+
- varcheck
31+
- ineffassign
32+
- deadcode
33+
- typecheck
34+
- gocyclo
35+
- goconst
36+
- misspell
37+
- lll
38+
- unparam
39+
- nakedret
40+
- prealloc
41+
- whitespace
42+
43+
run:
44+
timeout: 5m
45+
tests: true
46+
skip-dirs:
47+
- vendor
48+
- android
49+
- frontend/node_modules

0 commit comments

Comments
 (0)