@@ -16,97 +16,141 @@ permissions:
1616env :
1717 GO_VERSION : " 1.25.x"
1818 GOTOOLCHAIN : local
19+ GOLANGCI_LINT_VERSION : " v2.5.0"
1920
2021jobs :
21- build :
22- name : Build & Test
22+ modules :
23+ name : Modules
2324 runs-on : ubuntu-latest
2425 steps :
2526 - uses : actions/checkout@v4
26-
2727 - uses : actions/setup-go@v5
2828 with :
2929 go-version : ${{ env.GO_VERSION }}
3030 cache : true
3131 cache-dependency-path : go.sum
32-
3332 - name : Verify modules
3433 run : |
3534 go mod verify
3635 go mod tidy
3736 git diff --exit-code go.mod go.sum
3837
39- - name : Build CLI
40- run : go build -o /dev/null ./cli
38+ fmt :
39+ name : Format Check
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@v4
43+ - uses : actions/setup-go@v5
44+ with :
45+ go-version : ${{ env.GO_VERSION }}
46+ cache : true
47+ cache-dependency-path : go.sum
48+ - name : gofmt
49+ run : make fmt-check
4150
51+ build :
52+ name : Build (${{ matrix.os }})
53+ runs-on : ${{ matrix.os }}
54+ strategy :
55+ fail-fast : false
56+ matrix :
57+ os : [ubuntu-latest, macos-latest]
58+ steps :
59+ - uses : actions/checkout@v4
60+ - uses : actions/setup-go@v5
61+ with :
62+ go-version : ${{ env.GO_VERSION }}
63+ cache : true
64+ cache-dependency-path : go.sum
65+ - name : Build CLI
66+ run : make build-cli
4267 - name : Build Daemon
43- run : go build -o /dev/null ./daemon/cmd/nextdeployd
44-
45- - name : Test with coverage
46- run : go test -race -timeout 5m -coverprofile=coverage.out -covermode=atomic ./...
68+ if : runner.os == 'Linux'
69+ run : make build-daemon
4770
71+ test :
72+ name : Unit Tests
73+ runs-on : ubuntu-latest
74+ needs : [modules]
75+ steps :
76+ - uses : actions/checkout@v4
77+ - uses : actions/setup-go@v5
78+ with :
79+ go-version : ${{ env.GO_VERSION }}
80+ cache : true
81+ cache-dependency-path : go.sum
82+ - name : Run unit tests
83+ run : make test-unit
4884 - name : Coverage summary
4985 run : go tool cover -func=coverage.out | tail -1
50-
5186 - name : Upload coverage
5287 uses : actions/upload-artifact@v4
5388 with :
5489 name : coverage
5590 path : coverage.out
91+ retention-days : 7
5692
5793 lint :
5894 name : Lint
5995 runs-on : ubuntu-latest
96+ needs : [modules]
6097 permissions :
6198 contents : read
6299 pull-requests : read
63100 steps :
64101 - uses : actions/checkout@v4
65-
66102 - uses : actions/setup-go@v5
67103 with :
68104 go-version : ${{ env.GO_VERSION }}
69105 cache : true
70106 cache-dependency-path : go.sum
71-
72107 - name : golangci-lint
73108 uses : golangci/golangci-lint-action@v6
74109 with :
75- version : latest
110+ version : ${{ env.GOLANGCI_LINT_VERSION }}
76111 args : --timeout 10m
77112
78113 vuln :
79114 name : Vulnerability Check
80115 runs-on : ubuntu-latest
81116 steps :
82117 - uses : actions/checkout@v4
83-
84118 - name : govulncheck
85119 uses : golang/govulncheck-action@v1
86120 with :
87121 go-version-input : ${{ env.GO_VERSION }}
88122 check-latest : true
89123
124+ hook-smoke :
125+ name : Pre-commit Hook Smoke Test
126+ runs-on : ubuntu-latest
127+ steps :
128+ - uses : actions/checkout@v4
129+ - name : Validate hook syntax
130+ run : bash -n .githooks/pre-commit
131+ - name : Run hook against HEAD
132+ run : |
133+ # Stage everything from the last commit so the hook has something
134+ # to inspect, then run it. Catches accidental binaries on main.
135+ git -c user.email=ci@example.com -c user.name=ci \
136+ reset --soft HEAD~1 || true
137+ ./.githooks/pre-commit || (echo "Hook failed on HEAD"; exit 1)
138+
90139 quality :
91- name : Code Quality
140+ name : Code Quality (informational)
92141 runs-on : ubuntu-latest
93142 steps :
94143 - uses : actions/checkout@v4
95144 with :
96145 fetch-depth : 0
97-
98146 - uses : actions/setup-go@v5
99147 with :
100148 go-version : ${{ env.GO_VERSION }}
101149 cache : true
102150 cache-dependency-path : go.sum
103-
104- - name : Install scc (LOC counter)
151+ - name : Install scc
105152 run : go install github.com/boyter/scc/v3@latest
106-
107- - name : Lines of code report
153+ - name : Lines of code
108154 run : scc --format wide --exclude-dir vendor,test-serverless-app,.next
109-
110- - name : Benchmark
111- run : |
112- go test -bench=. -benchmem -run='^$' ./... 2>/dev/null || echo "No benchmarks found"
155+ - name : Benchmarks (best-effort)
156+ run : go test -bench=. -benchmem -run='^$' ./... 2>/dev/null || echo "No benchmarks found"
0 commit comments