-
Notifications
You must be signed in to change notification settings - Fork 465
621 lines (522 loc) · 21.1 KB
/
release.yml
File metadata and controls
621 lines (522 loc) · 21.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
name: Release Pipeline
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.3)'
required: true
type: string
skip_tests:
description: 'Skip test validation'
required: false
type: boolean
default: false
dry_run:
description: 'Dry run (no publishing)'
required: false
type: boolean
default: false
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Job 1: Validate code quality and run tests
validate:
name: Validate Code Quality
runs-on: ubuntu-22.04
if: ${{ !inputs.skip_tests }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: npm/package-lock.json
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v1-rust'
shared-key: 'validate'
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Run Rust tests
run: cargo test --workspace --all-features
env:
RUST_TEST_THREADS: 2
- name: Install npm dependencies
working-directory: npm
run: npm ci
- name: Run npm tests
working-directory: npm
run: npm run test:unit || true
- name: Generate validation summary
if: always()
run: |
echo "## Validation Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Code formatting checked" >> $GITHUB_STEP_SUMMARY
echo "✅ Clippy lints passed" >> $GITHUB_STEP_SUMMARY
echo "✅ Rust tests completed" >> $GITHUB_STEP_SUMMARY
echo "✅ npm tests completed" >> $GITHUB_STEP_SUMMARY
# Job 2: Build and test Rust crates
build-crates:
name: Build Rust Crates
runs-on: ubuntu-22.04
needs: validate
if: always() && (needs.validate.result == 'success' || needs.validate.result == 'skipped')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v1-rust'
shared-key: 'build-crates'
- name: Build all crates
run: cargo build --workspace --release
- name: Run crate tests
run: cargo test --workspace --release
env:
RUST_TEST_THREADS: 2
- name: Generate crate build summary
run: |
echo "## Crate Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Built Crates:" >> $GITHUB_STEP_SUMMARY
cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | "- \(.name) v\(.version)"' >> $GITHUB_STEP_SUMMARY
# Job 3: Build WASM packages
build-wasm:
name: Build WASM Packages
runs-on: ubuntu-22.04
needs: validate
if: always() && (needs.validate.result == 'success' || needs.validate.result == 'skipped')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: npm/package-lock.json
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v1-rust'
shared-key: 'wasm'
- name: Cache wasm-pack
uses: actions/cache@v4
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/wasm-pack
key: ${{ runner.os }}-wasm-pack-${{ hashFiles('**/Cargo.lock') }}
- name: Build ruvector-wasm
working-directory: crates/ruvector-wasm
run: wasm-pack build --target nodejs --out-dir ../../npm/packages/wasm/wasm-pkg
- name: Build ruvector-gnn-wasm
working-directory: crates/ruvector-gnn-wasm
run: wasm-pack build --target nodejs --release
- name: Build ruvector-graph-wasm
working-directory: crates/ruvector-graph-wasm
run: bash build.sh
- name: Build ruvector-tiny-dancer-wasm
working-directory: crates/ruvector-tiny-dancer-wasm
run: wasm-pack build --target nodejs --release
- name: Upload WASM artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-packages
path: |
npm/packages/wasm/wasm-pkg/**
crates/ruvector-gnn-wasm/pkg/**
crates/ruvector-graph-wasm/pkg/**
crates/ruvector-tiny-dancer-wasm/pkg/**
if-no-files-found: error
retention-days: 7
- name: Generate WASM build summary
run: |
echo "## WASM Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ ruvector-wasm built" >> $GITHUB_STEP_SUMMARY
echo "✅ ruvector-gnn-wasm built" >> $GITHUB_STEP_SUMMARY
echo "✅ ruvector-graph-wasm built" >> $GITHUB_STEP_SUMMARY
echo "✅ ruvector-tiny-dancer-wasm built" >> $GITHUB_STEP_SUMMARY
# Job 4: Build native Node.js modules (reuse existing workflow)
build-native:
name: Build Native Modules
needs: validate
if: always() && (needs.validate.result == 'success' || needs.validate.result == 'skipped')
uses: ./.github/workflows/build-native.yml
with:
skip_commit: true
# Job 5: Publish crates to crates.io
publish-crates:
name: Publish Rust Crates
runs-on: ubuntu-22.04
needs: [validate, build-crates]
if: |
always() &&
(needs.validate.result == 'success' || needs.validate.result == 'skipped') &&
needs.build-crates.result == 'success' &&
(startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch') &&
!inputs.dry_run
environment:
name: crates-io
url: https://crates.io/crates/ruvector-core
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v1-rust'
shared-key: 'publish'
- name: Verify CARGO_REGISTRY_TOKEN
run: |
if [ -z "${{ secrets.CARGO_REGISTRY_TOKEN }}" ]; then
echo "❌ CARGO_REGISTRY_TOKEN is not set"
exit 1
fi
echo "✅ CARGO_REGISTRY_TOKEN is configured"
- name: Publish crates in dependency order
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -e
# Define publishing order (dependencies first)
CRATES=(
"ruvector-core"
"ruvector-metrics"
"ruvector-filter"
"ruvector-snapshot"
"ruvector-collections"
"ruvector-router-core"
"ruvector-raft"
"ruvector-cluster"
"ruvector-replication"
"ruvector-gnn"
"ruvector-graph"
"ruvector-server"
"ruvector-tiny-dancer-core"
"ruvector-router-cli"
"ruvector-router-ffi"
"ruvector-router-wasm"
"ruvector-cli"
"ruvector-bench"
"ruvector-wasm"
"ruvector-node"
"ruvector-gnn-wasm"
"ruvector-gnn-node"
"ruvector-graph-wasm"
"ruvector-graph-node"
"ruvector-tiny-dancer-wasm"
"ruvector-tiny-dancer-node"
)
echo "## Crate Publishing Progress" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
for crate in "${CRATES[@]}"; do
echo "Publishing $crate..."
# Check if crate exists
if [ ! -d "crates/$crate" ]; then
echo "⏭️ Skipping $crate (not found)" >> $GITHUB_STEP_SUMMARY
continue
fi
cd "crates/$crate"
# Try to publish, continue if already published
if cargo publish --token "$CARGO_REGISTRY_TOKEN" --allow-dirty; then
echo "✅ Published $crate" >> $GITHUB_STEP_SUMMARY
# Wait to avoid rate limiting
sleep 10
else
echo "⚠️ Failed to publish $crate (may already exist)" >> $GITHUB_STEP_SUMMARY
fi
cd ../..
done
- name: Verify published crates
run: |
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Verification" >> $GITHUB_STEP_SUMMARY
echo "Check published crates at: https://crates.io/search?q=ruvector" >> $GITHUB_STEP_SUMMARY
# Job 6: Prepare npm packages for manual publishing
# NOTE: Automatic npm publishing disabled - packages are published manually
prepare-npm:
name: Prepare npm Packages
runs-on: ubuntu-22.04
needs: [validate, build-native, build-wasm]
if: |
always() &&
(needs.validate.result == 'success' || needs.validate.result == 'skipped') &&
needs.build-native.result == 'success' &&
needs.build-wasm.result == 'success' &&
(startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Download native binaries
uses: actions/download-artifact@v4
with:
pattern: bindings-*
path: artifacts
- name: Download WASM packages
uses: actions/download-artifact@v4
with:
name: wasm-packages
path: wasm-artifacts
- name: Copy native binaries to platform packages
run: |
for dir in artifacts/bindings-*/; do
platform=$(basename "$dir" | sed 's/bindings-//')
mkdir -p "npm/core/platforms/${platform}"
cp -v "$dir"/*.node "npm/core/platforms/${platform}/" || true
done
# Copy linux-x64 to native directory
if [ -f "npm/core/platforms/linux-x64-gnu/ruvector.node" ]; then
mkdir -p npm/core/native/linux-x64
cp -v npm/core/platforms/linux-x64-gnu/ruvector.node npm/core/native/linux-x64/
fi
- name: Copy WASM packages
run: |
# Copy main WASM package
if [ -d "wasm-artifacts/npm/packages/wasm/wasm-pkg" ]; then
cp -r wasm-artifacts/npm/packages/wasm/wasm-pkg/* npm/packages/wasm/wasm-pkg/
fi
- name: Install dependencies
working-directory: npm
run: npm ci || npm install --ignore-scripts
- name: Build npm packages
working-directory: npm
run: npm run build || echo "Build step skipped"
- name: Package artifacts for manual publishing
run: |
mkdir -p npm-publish-ready
# Copy platform binaries
cp -r npm/core/platforms npm-publish-ready/ || true
cp -r npm/core/native npm-publish-ready/ || true
# Create manifest
echo "# NPM Packages Ready for Publishing" > npm-publish-ready/README.md
echo "" >> npm-publish-ready/README.md
echo "## Platform binaries included:" >> npm-publish-ready/README.md
find npm-publish-ready/platforms -name "*.node" 2>/dev/null | while read f; do
echo "- $(basename $f)" >> npm-publish-ready/README.md
done
echo "" >> npm-publish-ready/README.md
echo "## Manual publishing commands:" >> npm-publish-ready/README.md
echo "\`\`\`bash" >> npm-publish-ready/README.md
echo "# Login to npm" >> npm-publish-ready/README.md
echo "npm login" >> npm-publish-ready/README.md
echo "" >> npm-publish-ready/README.md
echo "# Publish packages" >> npm-publish-ready/README.md
echo "cd npm/packages/core && npm publish --access public" >> npm-publish-ready/README.md
echo "cd npm/packages/wasm && npm publish --access public" >> npm-publish-ready/README.md
echo "cd npm/packages/cli && npm publish --access public" >> npm-publish-ready/README.md
echo "cd npm/packages/ruvector && npm publish --access public" >> npm-publish-ready/README.md
echo "\`\`\`" >> npm-publish-ready/README.md
- name: Upload npm-ready artifacts
uses: actions/upload-artifact@v4
with:
name: npm-publish-ready
path: npm-publish-ready/
retention-days: 30
- name: Generate npm preparation summary
run: |
echo "## npm Package Preparation Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Native binaries copied to platform packages" >> $GITHUB_STEP_SUMMARY
echo "✅ WASM packages prepared" >> $GITHUB_STEP_SUMMARY
echo "✅ Packages ready for manual publishing" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Manual Publishing Required" >> $GITHUB_STEP_SUMMARY
echo "Download the \`npm-publish-ready\` artifact and run:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "npm login" >> $GITHUB_STEP_SUMMARY
echo "npm publish --access public" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
# Job 7: Create GitHub release
create-release:
name: Create GitHub Release
runs-on: ubuntu-22.04
needs: [build-crates, build-native, build-wasm, publish-crates, prepare-npm]
if: |
always() &&
needs.build-crates.result == 'success' &&
needs.build-native.result == 'success' &&
needs.build-wasm.result == 'success' &&
(startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch')
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download native binaries
uses: actions/download-artifact@v4
with:
pattern: bindings-*
path: release-artifacts
- name: Download WASM packages
uses: actions/download-artifact@v4
with:
name: wasm-packages
path: release-artifacts/wasm
- name: Package artifacts for release
run: |
mkdir -p release-packages
# Package native binaries
for dir in release-artifacts/bindings-*/; do
platform=$(basename "$dir" | sed 's/bindings-//')
tar -czf "release-packages/ruvector-native-${platform}.tar.gz" -C "$dir" .
done
# Package WASM
tar -czf release-packages/ruvector-wasm.tar.gz -C release-artifacts/wasm .
- name: Generate release notes
id: release_notes
run: |
VERSION="${{ github.ref_name }}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="v${{ inputs.version }}"
fi
cat > release_notes.md <<EOF
# RuVector ${VERSION}
## 🚀 What's New
This release includes:
- High-performance Rust vector database core
- Node.js native bindings for all major platforms
- WebAssembly support for browser and Node.js
- Graph neural network capabilities
- Distributed clustering support
## 📦 Packages Published
### Rust Crates (crates.io)
- \`ruvector-core\` - Core vector database functionality
- \`ruvector-graph\` - Graph database capabilities
- \`ruvector-gnn\` - Graph neural networks
- \`ruvector-cluster\` - Distributed clustering
- And 20+ more specialized crates
### npm Packages
- \`@ruvector/core\` - Main Node.js package with platform-specific binaries
- \`@ruvector/wasm\` - WebAssembly bindings
- \`@ruvector/cli\` - Command-line interface
- \`@ruvector/extensions\` - Additional extensions
## 🏗️ Platform Support
### Native Node.js Modules
- ✅ Linux x64 (GNU)
- ✅ Linux ARM64 (GNU)
- ✅ macOS x64 (Intel)
- ✅ macOS ARM64 (Apple Silicon)
- ✅ Windows x64 (MSVC)
### WebAssembly
- ✅ All platforms via WASM
## 📥 Installation
\`\`\`bash
# Node.js
npm install @ruvector/core
# WASM
npm install @ruvector/wasm
# CLI
npm install -g @ruvector/cli
# Rust
cargo add ruvector-core
\`\`\`
## 🔗 Links
- [npm Package](https://www.npmjs.com/package/@ruvector/core)
- [crates.io](https://crates.io/crates/ruvector-core)
- [Documentation](https://github.com/ruvnet/ruvector)
- [Repository](https://github.com/ruvnet/ruvector)
## 📊 Metrics
- Total Rust Crates: 26
- Total npm Packages: 4+
- Supported Platforms: 5 native + WASM
- Binary Size: ~2-5 MB per platform
---
Built with ❤️ by the RuVector team
EOF
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.release_notes.outputs.version }}
name: RuVector ${{ steps.release_notes.outputs.version }}
body_path: release_notes.md
draft: false
prerelease: ${{ contains(steps.release_notes.outputs.version, 'alpha') || contains(steps.release_notes.outputs.version, 'beta') }}
files: |
release-packages/*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate release summary
run: |
echo "## 🎉 Release Created Successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Version: ${{ steps.release_notes.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published Artifacts:" >> $GITHUB_STEP_SUMMARY
ls -lh release-packages/ >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Release URL:" >> $GITHUB_STEP_SUMMARY
echo "https://github.com/${{ github.repository }}/releases/tag/${{ steps.release_notes.outputs.version }}" >> $GITHUB_STEP_SUMMARY
# Summary job to report overall status
release-summary:
name: Release Summary
runs-on: ubuntu-22.04
needs: [validate, build-crates, build-native, build-wasm, publish-crates, prepare-npm, create-release]
if: always()
steps:
- name: Generate final summary
run: |
echo "# 🚀 RuVector Release Pipeline Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Job Status" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Validate | ${{ needs.validate.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Build Crates | ${{ needs.build-crates.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Build Native | ${{ needs.build-native.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Build WASM | ${{ needs.build-wasm.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Publish Crates | ${{ needs.publish-crates.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Prepare npm | ${{ needs.prepare-npm.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Create Release | ${{ needs.create-release.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.create-release.result }}" = "success" ]; then
echo "## ✅ Release completed successfully!" >> $GITHUB_STEP_SUMMARY
else
echo "## ⚠️ Release completed with some warnings or failures" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
echo "- Verify packages on [crates.io](https://crates.io/search?q=ruvector)" >> $GITHUB_STEP_SUMMARY
echo "- Verify packages on [npm](https://www.npmjs.com/search?q=%40ruvector)" >> $GITHUB_STEP_SUMMARY
echo "- Check [GitHub releases](https://github.com/${{ github.repository }}/releases)" >> $GITHUB_STEP_SUMMARY
echo "- Update documentation if needed" >> $GITHUB_STEP_SUMMARY