mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-04 02:42:57 +00:00
241 lines
8.8 KiB
YAML
241 lines
8.8 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
paths:
|
|
- Cargo.toml
|
|
- rust/**
|
|
- .github/workflows/rust.yml
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# This env var is used by Swatinem/rust-cache@v2 for the cache
|
|
# key, so we set it to make sure it is always consistent.
|
|
CARGO_TERM_COLOR: always
|
|
# Disable full debug symbol generation to speed up CI build and keep memory down
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
RUSTFLAGS: "-C debuginfo=1"
|
|
RUST_BACKTRACE: "1"
|
|
|
|
jobs:
|
|
lint:
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-24.04
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
# Need up-to-date compilers for kernels
|
|
CC: clang-18
|
|
CXX: clang++-18
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: rust
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y protobuf-compiler libssl-dev
|
|
- name: Run format
|
|
run: cargo fmt --all -- --check
|
|
- name: Run clippy
|
|
run: cargo clippy --workspace --tests --all-features -- -D warnings
|
|
|
|
linux:
|
|
timeout-minutes: 30
|
|
# To build all features, we need more disk space than is available
|
|
# on the free OSS github runner. This is mostly due to the the
|
|
# sentence-transformers feature.
|
|
runs-on: ubuntu-2404-4x-x64
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: rust
|
|
env:
|
|
# Need up-to-date compilers for kernels
|
|
CC: clang-18
|
|
CXX: clang++-18
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: rust
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y protobuf-compiler libssl-dev
|
|
- name: Make Swap
|
|
run: |
|
|
sudo fallocate -l 16G /swapfile
|
|
sudo chmod 600 /swapfile
|
|
sudo mkswap /swapfile
|
|
sudo swapon /swapfile
|
|
- name: Start S3 integration test environment
|
|
working-directory: .
|
|
run: docker compose up --detach --wait
|
|
- name: Build
|
|
run: cargo build --all-features
|
|
- name: Run tests
|
|
run: cargo test --all-features
|
|
- name: Run examples
|
|
run: cargo run --example simple
|
|
|
|
macos:
|
|
timeout-minutes: 30
|
|
strategy:
|
|
matrix:
|
|
mac-runner: ["macos-13", "macos-14"]
|
|
runs-on: "${{ matrix.mac-runner }}"
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: rust
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
- name: CPU features
|
|
run: sysctl -a | grep cpu
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: rust
|
|
- name: Install dependencies
|
|
run: brew install protobuf
|
|
- name: Build
|
|
run: cargo build --all-features
|
|
- name: Run tests
|
|
# Run with everything except the integration tests.
|
|
run: cargo test --features remote,fp16kernels
|
|
|
|
windows:
|
|
runs-on: windows-2022
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: rust
|
|
- name: Install Protoc v21.12
|
|
working-directory: C:\
|
|
run: |
|
|
New-Item -Path 'C:\protoc' -ItemType Directory
|
|
Set-Location C:\protoc
|
|
Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip -OutFile C:\protoc\protoc.zip
|
|
7z x protoc.zip
|
|
Add-Content $env:GITHUB_PATH "C:\protoc\bin"
|
|
shell: powershell
|
|
- name: Run tests
|
|
run: |
|
|
$env:VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
|
|
cargo build
|
|
cargo test
|
|
|
|
windows-arm64:
|
|
runs-on: windows-4x-arm
|
|
steps:
|
|
- name: Install Git
|
|
run: |
|
|
Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.exe" -OutFile "git-installer.exe"
|
|
Start-Process -FilePath "git-installer.exe" -ArgumentList "/VERYSILENT", "/NORESTART" -Wait
|
|
shell: powershell
|
|
- name: Add Git to PATH
|
|
run: |
|
|
Add-Content $env:GITHUB_PATH "C:\Program Files\Git\bin"
|
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
|
shell: powershell
|
|
- name: Configure Git symlinks
|
|
run: git config --global core.symlinks true
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
- name: Install Visual Studio Build Tools
|
|
run: |
|
|
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_buildtools.exe" -OutFile "vs_buildtools.exe"
|
|
Start-Process -FilePath "vs_buildtools.exe" -ArgumentList "--quiet", "--wait", "--norestart", "--nocache", `
|
|
"--installPath", "C:\BuildTools", `
|
|
"--add", "Microsoft.VisualStudio.Component.VC.Tools.ARM64", `
|
|
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", `
|
|
"--add", "Microsoft.VisualStudio.Component.Windows11SDK.22621", `
|
|
"--add", "Microsoft.VisualStudio.Component.VC.ATL", `
|
|
"--add", "Microsoft.VisualStudio.Component.VC.ATLMFC", `
|
|
"--add", "Microsoft.VisualStudio.Component.VC.Llvm.Clang" -Wait
|
|
shell: powershell
|
|
- name: Add Visual Studio Build Tools to PATH
|
|
run: |
|
|
$vsPath = "C:\BuildTools\VC\Tools\MSVC"
|
|
$latestVersion = (Get-ChildItem $vsPath | Sort-Object {[version]$_.Name} -Descending)[0].Name
|
|
Add-Content $env:GITHUB_PATH "C:\BuildTools\VC\Tools\MSVC\$latestVersion\bin\Hostx64\arm64"
|
|
Add-Content $env:GITHUB_PATH "C:\BuildTools\VC\Tools\MSVC\$latestVersion\bin\Hostx64\x64"
|
|
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\arm64"
|
|
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64"
|
|
Add-Content $env:GITHUB_PATH "C:\BuildTools\VC\Tools\Llvm\x64\bin"
|
|
|
|
# Add MSVC runtime libraries to LIB
|
|
$env:LIB = "C:\BuildTools\VC\Tools\MSVC\$latestVersion\lib\arm64;" +
|
|
"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\arm64;" +
|
|
"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\arm64"
|
|
Add-Content $env:GITHUB_ENV "LIB=$env:LIB"
|
|
|
|
# Add INCLUDE paths
|
|
$env:INCLUDE = "C:\BuildTools\VC\Tools\MSVC\$latestVersion\include;" +
|
|
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt;" +
|
|
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um;" +
|
|
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared"
|
|
Add-Content $env:GITHUB_ENV "INCLUDE=$env:INCLUDE"
|
|
shell: powershell
|
|
- name: Install Rust
|
|
run: |
|
|
Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
|
|
.\rustup-init.exe -y --default-host aarch64-pc-windows-msvc
|
|
shell: powershell
|
|
- name: Add Rust to PATH
|
|
run: |
|
|
Add-Content $env:GITHUB_PATH "$env:USERPROFILE\.cargo\bin"
|
|
shell: powershell
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: rust
|
|
- name: Install 7-Zip ARM
|
|
run: |
|
|
New-Item -Path 'C:\7zip' -ItemType Directory
|
|
Invoke-WebRequest https://7-zip.org/a/7z2408-arm64.exe -OutFile C:\7zip\7z-installer.exe
|
|
Start-Process -FilePath C:\7zip\7z-installer.exe -ArgumentList '/S' -Wait
|
|
shell: powershell
|
|
- name: Add 7-Zip to PATH
|
|
run: Add-Content $env:GITHUB_PATH "C:\Program Files\7-Zip"
|
|
shell: powershell
|
|
- name: Install Protoc v21.12
|
|
working-directory: C:\
|
|
run: |
|
|
if (Test-Path 'C:\protoc') {
|
|
Write-Host "Protoc directory exists, skipping installation"
|
|
return
|
|
}
|
|
New-Item -Path 'C:\protoc' -ItemType Directory
|
|
Set-Location C:\protoc
|
|
Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip -OutFile C:\protoc\protoc.zip
|
|
& 'C:\Program Files\7-Zip\7z.exe' x protoc.zip
|
|
shell: powershell
|
|
- name: Add Protoc to PATH
|
|
run: Add-Content $env:GITHUB_PATH "C:\protoc\bin"
|
|
shell: powershell
|
|
- name: Run tests
|
|
run: |
|
|
$env:VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
|
|
cargo build --target aarch64-pc-windows-msvc
|
|
cargo test --target aarch64-pc-windows-msvc
|