Repository navigation
238 lines (196 loc) · 7.55 KB
/
Copy pathci.yml
File metadata and controls
238 lines (196 loc) · 7.55 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
knowledge-audit:
name: Audit knowledge risks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: packages/cli/go.mod
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
with:
version: 10
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build viewer assets
run: pnpm build:viewer
- name: Audit knowledge risks
run: |
go build -o "$RUNNER_TEMP/okn" ./packages/cli/cmd/openknowledge
mkdir -p "$RUNNER_TEMP/openknowledge-reports"
"$RUNNER_TEMP/okn" --no-telemetry validate Wiki
"$RUNNER_TEMP/okn" --no-telemetry claims validate --path Wiki --json \
> "$RUNNER_TEMP/openknowledge-reports/claims-validation.json"
"$RUNNER_TEMP/okn" --no-telemetry eval claims \
.openknowledge/evals/wiki-claims.yaml Wiki --format json \
--max-stale 0 --max-hallucinated 0 --max-unverified 0 \
--out "$RUNNER_TEMP/openknowledge-reports/claim-replay.json"
"$RUNNER_TEMP/okn" --no-telemetry audit Wiki \
--baseline .openknowledge/audit-sources.json \
--observe-remote \
--fail-on high --format json --out "$RUNNER_TEMP/openknowledge-reports/audit.json"
- name: Validate claim lifecycle against base
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.event.before != '0000000000000000000000000000000000000000')
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
git worktree add --detach "$RUNNER_TEMP/openknowledge-base" "$BASE_SHA"
"$RUNNER_TEMP/okn" --no-telemetry claims validate --path Wiki \
--against "$RUNNER_TEMP/openknowledge-base/Wiki" --json \
> "$RUNNER_TEMP/openknowledge-reports/claims-lifecycle.json"
- name: Upload knowledge audit report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: knowledge-audit-report
path: ${{ runner.temp }}/openknowledge-reports
if-no-files-found: error
retention-days: 14
knowledge-eval:
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.event.before != '0000000000000000000000000000000000000000')
uses: ./.github/workflows/knowledge-eval.yml
with:
dataset: .openknowledge/evals/wiki.yaml
target: Wiki
base_ref: ${{ github.event.pull_request.base.sha || github.event.before }}
gate: regressions
verify:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Reject tracked viewer build output
shell: bash
run: |
tracked="$(git ls-files -- packages/cli/cmd/openknowledge/viewer_assets)"
if [ -n "$tracked" ]; then
echo "Compiled viewer assets must not be committed:" >&2
printf '%s\n' "$tracked" >&2
exit 1
fi
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: packages/cli/go.mod
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
with:
version: 10
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Verify Go modules are tidy
shell: bash
run: |
go -C packages/cli mod tidy
git diff --exit-code -- packages/cli/go.mod packages/cli/go.sum
- name: Verify source formatting
run: pnpm check:format
- name: Test
run: pnpm test
- name: Gate deterministic retrieval quality
run: |
go build -o "$RUNNER_TEMP/okn-retrieval" ./packages/cli/cmd/openknowledge
"$RUNNER_TEMP/okn-retrieval" --no-telemetry eval retrieval \
packages/cli/internal/eval/testdata/earnings-retrieval-v1/retrieval.yaml \
packages/cli/internal/eval/testdata/earnings-retrieval-v1/knowledge
"$RUNNER_TEMP/okn-retrieval" --no-telemetry eval retrieval \
.openknowledge/evals/wiki-retrieval.yaml Wiki
- name: Test Go race safety and collect coverage
run: |
pnpm test:race
pnpm test:coverage
go tool cover -func=coverage.out
- name: Vet
run: go vet ./packages/cli/...
- name: Build
run: pnpm build
- name: Install browser test runtime
run: pnpm exec playwright install --with-deps chromium
- name: Test browser journeys and accessibility
run: pnpm test:browser
- name: Validate repository wiki
run: ./bin/openknowledge validate Wiki
go-platforms:
name: Go tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: packages/cli/go.mod
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
with:
version: 10
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build viewer assets
run: pnpm build:viewer
- name: Test CLI
run: go test -timeout 20m ./packages/cli/...
- name: Build CLI
run: go build ./packages/cli/cmd/openknowledge
node-20:
name: Node 20 compatibility
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
with:
version: 10
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test supported Node baseline
run: |
pnpm test:npm-install
pnpm test:packed-npm
pnpm test:web
pnpm build:web