Elffuss BraidHub

kikocis/lancedb public

e822b4e34fb7 · 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 env:
34 # Need up-to-date compilers for kernels
35 CC: gcc-12
36 CXX: g++-12
37 steps:
38 - uses: actions/checkout@v4
39 with:
40 fetch-depth: 0
41 lfs: true
42 - uses: Swatinem/rust-cache@v2
43 with:
44 workspaces: rust
45 - name: Install dependencies
46 run: |
47 sudo apt update
48 sudo apt install -y protobuf-compiler libssl-dev
49 - name: Run format
50 run: cargo fmt --all -- --check
51 - name: Run clippy
52 run: cargo clippy --workspace --tests --all-features -- -D warnings
53 linux:
54 timeout-minutes: 30
55 # To build all features, we need more disk space than is available
56 # on the GitHub-provided runner. This is mostly due to the the
57 # sentence-transformers feature.
58 runs-on: warp-ubuntu-latest-x64-4x
59 defaults:
60 run:
61 shell: bash
62 working-directory: rust
63 env:
64 # Need up-to-date compilers for kernels
65 CC: gcc-12
66 CXX: g++-12
67 steps:
68 - uses: actions/checkout@v4
69 with:
70 fetch-depth: 0
71 lfs: true
72 - uses: Swatinem/rust-cache@v2
73 with:
74 workspaces: rust
75 - name: Install dependencies
76 run: |
77 sudo apt update
78 sudo apt install -y protobuf-compiler libssl-dev
79 - name: Start S3 integration test environment
80 working-directory: .
81 run: docker compose up --detach --wait
82 - name: Build
83 run: cargo build --all-features
84 - name: Run tests
85 run: cargo test --all-features
86 - name: Run examples
87 run: cargo run --example simple
88 macos:
89 timeout-minutes: 30
90 strategy:
91 matrix:
92 mac-runner: [ "macos-13", "macos-14" ]
93 runs-on: "${{ matrix.mac-runner }}"
94 defaults:
95 run:
96 shell: bash
97 working-directory: rust
98 steps:
99 - uses: actions/checkout@v4
100 with:
101 fetch-depth: 0
102 lfs: true
103 - name: CPU features
104 run: sysctl -a | grep cpu
105 - uses: Swatinem/rust-cache@v2
106 with:
107 workspaces: rust
108 - name: Install dependencies
109 run: brew install protobuf
110 - name: Build
111 run: cargo build --all-features
112 - name: Run tests
113 # Run with everything except the integration tests.
114 run: cargo test --features remote,fp16kernels
115 windows:
116 runs-on: windows-2022
117 steps:
118 - uses: actions/checkout@v4
119 - uses: Swatinem/rust-cache@v2
120 with:
121 workspaces: rust
122 - name: Install Protoc v21.12
123 working-directory: C:\
124 run: |
125 New-Item -Path 'C:\protoc' -ItemType Directory
126 Set-Location C:\protoc
127 Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip -OutFile C:\protoc\protoc.zip
128 7z x protoc.zip
129 Add-Content $env:GITHUB_PATH "C:\protoc\bin"
130 shell: powershell
131 - name: Run tests
132 run: |
133 $env:VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
134 cargo build
135 cargo test