-
Notifications
You must be signed in to change notification settings - Fork 0
333 lines (286 loc) · 11.1 KB
/
Copy pathci.yml
File metadata and controls
333 lines (286 loc) · 11.1 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
build-test-lint:
name: Build/Test/Lint (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Normalize line endings on Windows
if: runner.os == 'Windows'
shell: bash
run: |
git config --local core.autocrlf false
git config --local core.eol lf
git reset --hard HEAD
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # pinned action commit
with:
toolchain: 1.93.1
components: clippy
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: "shim -> target"
- name: Set up protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: "31.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify protoc
run: protoc --version
- name: Build Rust shim (debug)
working-directory: shim
run: cargo build --locked
- name: Run Go tests
shell: pwsh
run: |
$libName = switch ("${{ runner.os }}") {
"Linux" { "libchroma_shim.so" }
"macOS" { "libchroma_shim.dylib" }
"Windows" { "chroma_shim.dll" }
default { throw "Unsupported OS: ${{ runner.os }}" }
}
$env:CHROMA_LIB_PATH = [System.IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "shim/target/debug/$libName"))
Write-Host "CHROMA_LIB_PATH=$env:CHROMA_LIB_PATH"
go test -v ./...
- name: Run Go lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
args: --timeout=30m ./...
- name: Run Rust lint
working-directory: shim
run: cargo clippy --locked -- -D warnings
java-jna:
name: Java JNA Smoke (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Normalize line endings on Windows
if: runner.os == 'Windows'
shell: bash
run: |
git config --local core.autocrlf false
git config --local core.eol lf
git reset --hard HEAD
- name: Set up Rust
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # pinned action commit
with:
toolchain: 1.93.1
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: "shim -> target"
- name: Set up protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: "31.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify protoc
run: protoc --version
- name: Set up Java 17
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: "17"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- name: Build Rust shim (debug)
working-directory: shim
run: cargo build --locked
- name: Run Java JNA smoke tests
shell: pwsh
run: |
$libName = switch ("${{ runner.os }}") {
"Linux" { "libchroma_shim.so" }
"macOS" { "libchroma_shim.dylib" }
"Windows" { "chroma_shim.dll" }
default { throw "Unsupported OS: ${{ runner.os }}" }
}
$env:CHROMA_LIB_PATH = [System.IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "shim/target/debug/$libName"))
Write-Host "CHROMA_LIB_PATH=$env:CHROMA_LIB_PATH"
Push-Location "$env:GITHUB_WORKSPACE/java"
try {
gradle --no-daemon :jna:test
} finally {
Pop-Location
}
java-panama:
name: Java Panama Smoke (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Normalize line endings on Windows
if: runner.os == 'Windows'
shell: bash
run: |
git config --local core.autocrlf false
git config --local core.eol lf
git reset --hard HEAD
- name: Set up Rust
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # pinned action commit
with:
toolchain: 1.93.1
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: "shim -> target"
- name: Set up protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: "31.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify protoc
run: protoc --version
- name: Set up Java 22
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: "22"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- name: Build Rust shim (debug)
working-directory: shim
run: cargo build --locked
- name: Run Java Panama smoke tests
shell: pwsh
run: |
$libName = switch ("${{ runner.os }}") {
"Linux" { "libchroma_shim.so" }
"macOS" { "libchroma_shim.dylib" }
"Windows" { "chroma_shim.dll" }
default { throw "Unsupported OS: ${{ runner.os }}" }
}
$env:CHROMA_LIB_PATH = [System.IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "shim/target/debug/$libName"))
Write-Host "CHROMA_LIB_PATH=$env:CHROMA_LIB_PATH"
Push-Location "$env:GITHUB_WORKSPACE/java"
try {
$maxAttempts = if ("${{ runner.os }}" -eq "Windows") { 3 } else { 1 }
$attempt = 1
while ($true) {
Write-Host "Running Panama smoke tests (attempt $attempt/$maxAttempts)"
gradle --no-daemon :panama:test
if ($LASTEXITCODE -eq 0) {
break
}
if ($attempt -ge $maxAttempts) {
throw "Panama smoke tests failed after $attempt attempts (exit code $LASTEXITCODE)."
}
Write-Warning "Panama smoke tests failed with exit code $LASTEXITCODE; retrying in 10 seconds."
gradle --stop | Out-Null
Start-Sleep -Seconds 10
$attempt++
}
} finally {
Pop-Location
}
- name: Dump Panama crash diagnostics (Windows)
if: failure() && runner.os == 'Windows'
shell: pwsh
run: |
$panamaDir = Join-Path $env:GITHUB_WORKSPACE "java/panama"
$hsErrLogs = Get-ChildItem -Path $panamaDir -Filter "hs_err_pid*.log" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending
$hsErrDumps = Get-ChildItem -Path $panamaDir -Filter "hs_err_pid*.mdmp" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending
if ($hsErrLogs.Count -eq 0) {
Write-Host "No hs_err logs found in $panamaDir"
} else {
foreach ($log in $hsErrLogs) {
Write-Host "==== hs_err log: $($log.FullName) ===="
Get-Content $log.FullName -TotalCount 400
}
}
if ($hsErrDumps.Count -eq 0) {
Write-Host "No mdmp files found in $panamaDir"
} else {
foreach ($dump in $hsErrDumps) {
Write-Host "Found mdmp: $($dump.FullName)"
}
}
$testResultsDir = Join-Path $panamaDir "build/test-results/test"
if (Test-Path $testResultsDir) {
Write-Host "==== test result files in $testResultsDir ===="
Get-ChildItem -Path $testResultsDir -Recurse | Select-Object FullName, Length
} else {
Write-Host "No test results directory found at $testResultsDir"
}
- name: Upload Panama crash artifacts (Windows)
if: failure() && runner.os == 'Windows'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: panama-windows-crash-artifacts
path: |
java/panama/hs_err_pid*.log
java/panama/hs_err_pid*.mdmp
java/panama/build/test-results/test/**
java/panama/build/reports/tests/test/**
if-no-files-found: warn
api-compat:
name: API Compatibility Check
if: github.event_name == 'pull_request' && github.base_ref == 'main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: stable
cache: true
- name: Run API compatibility check
run: |
go install golang.org/x/exp/cmd/apidiff@latest
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -1)
if [ -z "$LATEST_TAG" ]; then
echo "No release tags found -- skipping apidiff"
exit 0
fi
echo "Comparing against: $LATEST_TAG"
OLD_DIR=$(go mod download -json "github.com/amikos-tech/chroma-go-local@${LATEST_TAG}" | jq -r .Dir)
cd "$OLD_DIR" && apidiff -w /tmp/old.txt github.com/amikos-tech/chroma-go-local
cd "$GITHUB_WORKSPACE" && apidiff -w /tmp/new.txt github.com/amikos-tech/chroma-go-local
echo "## API Diff (vs $LATEST_TAG)" >> "$GITHUB_STEP_SUMMARY"
if apidiff -incompatible /tmp/old.txt /tmp/new.txt > /tmp/diff.txt 2>&1; then
echo "No incompatible changes detected." >> "$GITHUB_STEP_SUMMARY"
else
echo '```' >> "$GITHUB_STEP_SUMMARY"
cat /tmp/diff.txt >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "::warning::API changes detected vs $LATEST_TAG - review step summary"
fi
exit 0