Elffuss BraidHub

kikocis/lancedb public

4a63e77b7e97 · 3.7 KiBRawPermalink
1name: Rust
2
3on:
4 push:
5 branches:
6 - main
7 pull_request:
8 paths:
9 - Cargo.toml
10 - rust/**
11 - .github/workflows/rust.yml
12
13concurrency:
14 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15 cancel-in-progress: true
16
17env:
18 # This env var is used by Swatinem/rust-cache@v2 for the cache
19 # key, so we set it to make sure it is always consistent.
20 CARGO_TERM_COLOR: always
21 # Disable full debug symbol generation to speed up CI build and keep memory down
22 # "1" means line tables only, which is useful for panic tracebacks.
23 RUSTFLAGS: "-C debuginfo=1"
24 RUST_BACKTRACE: "1"
25
26jobs:
27 lint:
28 timeout-minutes: 30
29 runs-on: ubuntu-22.04
30 defaults:
31 run:
32 shell: bash
33 working-directory: rust
34 env:
35 # Need up-to-date compilers for kernels
36 CC: gcc-12
37 CXX: g++-12
38 steps:
39 - uses: actions/checkout@v4
40 with:
41 fetch-depth: 0
42 lfs: true
43 - uses: Swatinem/rust-cache@v2
44 with:
45 workspaces: rust
46 - name: Install dependencies
47 run: |
48 sudo apt update
49 sudo apt install -y protobuf-compiler libssl-dev
50 - name: Run format
51 run: cargo fmt --all -- --check
52 - name: Run clippy
53 run: cargo clippy --all --all-features -- -D warnings
54 linux:
55 timeout-minutes: 30
56 # To build all features, we need more disk space than is available
57 # on the GitHub-provided runner. This is mostly due to the the
58 # sentence-transformers feature.
59 runs-on: warp-ubuntu-latest-x64-4x
60 defaults:
61 run:
62 shell: bash
63 working-directory: rust
64 env:
65 # Need up-to-date compilers for kernels
66 CC: gcc-12
67 CXX: g++-12
68 steps:
69 - uses: actions/checkout@v4
70 with:
71 fetch-depth: 0
72 lfs: true
73 - uses: Swatinem/rust-cache@v2
74 with:
75 workspaces: rust
76 - name: Install dependencies
77 run: |
78 sudo apt update
79 sudo apt install -y protobuf-compiler libssl-dev
80 - name: Start S3 integration test environment
81 working-directory: .
82 run: docker compose up --detach --wait
83 - name: Build
84 run: cargo build --all-features
85 - name: Run tests
86 run: cargo test --all-features
87 - name: Run examples
88 run: cargo run --example simple
89 macos:
90 timeout-minutes: 30
91 strategy:
92 matrix:
93 mac-runner: [ "macos-13", "macos-14" ]
94 runs-on: "${{ matrix.mac-runner }}"
95 defaults:
96 run:
97 shell: bash
98 working-directory: rust
99 steps:
100 - uses: actions/checkout@v4
101 with:
102 fetch-depth: 0
103 lfs: true
104 - name: CPU features
105 run: sysctl -a | grep cpu
106 - uses: Swatinem/rust-cache@v2
107 with:
108 workspaces: rust
109 - name: Install dependencies
110 run: brew install protobuf
111 - name: Build
112 run: cargo build --all-features
113 - name: Run tests
114 # Run with everything except the integration tests.
115 run: cargo test --features remote,fp16kernels
116 windows:
117 runs-on: windows-2022
118 steps:
119 - uses: actions/checkout@v4
120 - uses: Swatinem/rust-cache@v2
121 with:
122 workspaces: rust
123 - name: Install Protoc v21.12
124 working-directory: C:\
125 run: |
126 New-Item -Path 'C:\protoc' -ItemType Directory
127 Set-Location C:\protoc
128 Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip -OutFile C:\protoc\protoc.zip
129 7z x protoc.zip
130 Add-Content $env:GITHUB_PATH "C:\protoc\bin"
131 shell: powershell
132 - name: Run tests
133 run: |
134 $env:VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
135 cargo build
136 cargo test