Repository navigation
180 lines (151 loc) · 5.12 KB
/
Copy pathci.yml
File metadata and controls
180 lines (151 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: ci
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
race: true
- os: macos-latest
race: true
- os: windows-latest
race: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.6"
check-latest: true
- name: go mod tidy
shell: bash
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: gofmt
shell: bash
run: |
out=$(gofmt -l .)
if [ -n "$out" ]; then
echo "gofmt found unformatted files:"
echo "$out"
exit 1
fi
- name: go vet
run: go vet ./...
- name: go test (race)
if: matrix.race
run: go test -race ./...
- name: go test
if: ${{ !matrix.race }}
run: go test ./...
- name: go build
run: go build -buildvcs=false ./cmd/numbat
lint:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.6"
check-latest: true
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2
# golangci-lint run does not execute formatters in v2; fmt does. This
# gates gofumpt (and gofmt) on top of the lint pass above, reusing the
# binary the action installed.
- name: golangci-lint fmt
run: golangci-lint fmt --diff
fuzz:
name: fuzz
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.6"
check-latest: true
# Each invocation selects one target, so keep every FuzzXxx function in
# the tree listed here. Runs are bounded to keep the job predictable.
- name: fuzz extract parsers
run: |
for t in FuzzClaudeExtract FuzzCodexExtract FuzzGeminiExtract FuzzPiExtract \
FuzzKimiCodeExtract FuzzGeminiSessionExtract FuzzCursorExtract \
FuzzWindsurfExtract FuzzOpenCodeExtract FuzzOpenClawExtract \
FuzzCodexCodeModeExecCommand; do
go test -run='^$' -fuzz="^${t}$" -fuzztime=30s ./internal/extract/
done
- name: fuzz redaction decoder
run: |
for t in FuzzString FuzzJSONProducesValidJSON; do
go test -run='^$' -fuzz="^${t}$" -fuzztime=30s ./internal/redact/
done
- name: fuzz shell command analysis
run: go test -run='^$' -fuzz='^FuzzAnalyzeShellCommands$' -fuzztime=30s ./internal/rule/
- name: fuzz OTLP decoder
run: go test -run='^$' -fuzz='^FuzzOTLPLogs$' -fuzztime=30s ./internal/otel/
coverage:
name: coverage (informational)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.6"
check-latest: true
# Non-gating: report total coverage for visibility, never fail the build
# on it. No threshold is enforced.
- name: go test coverage
run: go test -coverprofile=coverage.out ./...
- name: coverage summary
run: |
go tool cover -func=coverage.out | tail -n 1
{
echo "### Coverage (informational)"
echo '```'
go tool cover -func=coverage.out | tail -n 1
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: upload coverage profile
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-profile
path: coverage.out
govulncheck:
name: govulncheck
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.6"
check-latest: true
- name: install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@v1.6.0
- name: govulncheck
run: govulncheck ./...