git-subtree-dir: vendor/ruvector git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
name: Build and Test
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main, develop]
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
settings:
|
|
- host: macos-latest
|
|
target: x86_64-apple-darwin
|
|
build: npm run build
|
|
- host: macos-latest
|
|
target: aarch64-apple-darwin
|
|
build: npm run build -- --target aarch64-apple-darwin
|
|
- host: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
build: npm run build
|
|
- host: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
build: npm run build -- --target x86_64-unknown-linux-musl
|
|
- host: ubuntu-latest
|
|
target: aarch64-unknown-linux-gnu
|
|
build: npm run build -- --target aarch64-unknown-linux-gnu
|
|
- host: ubuntu-latest
|
|
target: aarch64-unknown-linux-musl
|
|
build: npm run build -- --target aarch64-unknown-linux-musl
|
|
- host: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
build: npm run build
|
|
|
|
name: Build ${{ matrix.settings.target }}
|
|
runs-on: ${{ matrix.settings.host }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
cache: npm
|
|
cache-dependency-path: crates/ruvector-gnn-node/package.json
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.settings.target }}
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ matrix.settings.target }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install dependencies
|
|
working-directory: crates/ruvector-gnn-node
|
|
run: npm install
|
|
|
|
- name: Build
|
|
working-directory: crates/ruvector-gnn-node
|
|
run: ${{ matrix.settings.build }}
|
|
|
|
- name: Test (non-cross compile only)
|
|
if: matrix.settings.host == 'ubuntu-latest' && matrix.settings.target == 'x86_64-unknown-linux-gnu'
|
|
working-directory: crates/ruvector-gnn-node
|
|
run: npm test
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bindings-${{ matrix.settings.target }}
|
|
path: crates/ruvector-gnn-node/*.node
|
|
if-no-files-found: error
|
|
|
|
test:
|
|
name: Test Node.js bindings
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-x86_64-unknown-linux-gnu
|
|
path: crates/ruvector-gnn-node
|
|
|
|
- name: Install dependencies
|
|
working-directory: crates/ruvector-gnn-node
|
|
run: npm install --ignore-scripts
|
|
|
|
- name: Run tests
|
|
working-directory: crates/ruvector-gnn-node
|
|
run: npm test
|