|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +env: |
| 13 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 14 | + CARGO_PROFILE_RELEASE_LTO: thin |
| 15 | + CUDA_COMPUTE_CAP: "86" |
| 16 | + |
| 17 | +jobs: |
| 18 | + linux-cpu-x64: |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Clone |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Install Rust |
| 28 | + uses: dtolnay/rust-toolchain@stable |
| 29 | + with: |
| 30 | + targets: x86_64-unknown-linux-gnu |
| 31 | + |
| 32 | + - name: Install system dependencies |
| 33 | + run: | |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y build-essential |
| 36 | +
|
| 37 | + - name: Build |
| 38 | + run: | |
| 39 | + cargo build --release --features mkl --target x86_64-unknown-linux-gnu |
| 40 | +
|
| 41 | + - name: Get version info |
| 42 | + id: version |
| 43 | + run: | |
| 44 | + SHORT_HASH=$(git rev-parse --short=7 HEAD) |
| 45 | + echo "version=${SHORT_HASH}" >> $GITHUB_OUTPUT |
| 46 | +
|
| 47 | + - name: Pack artifacts |
| 48 | + run: | |
| 49 | + mkdir -p release |
| 50 | + tar -czvf vecBox-${{ steps.version.outputs.version }}-bin-linux-cpu-x86_64.tar.gz -C target/x86_64-unknown-linux-gnu/release vecBox |
| 51 | +
|
| 52 | + - name: Upload artifacts |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + path: vecBox-${{ steps.version.outputs.version }}-bin-linux-cpu-x86_64.tar.gz |
| 56 | + name: vecBox-bin-linux-cpu-x86_64.tar.gz |
| 57 | + |
| 58 | + linux-cuda-x64: |
| 59 | + runs-on: ubuntu-22.04 |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Clone |
| 63 | + uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + fetch-depth: 0 |
| 66 | + |
| 67 | + - name: Install Rust |
| 68 | + uses: dtolnay/rust-toolchain@stable |
| 69 | + with: |
| 70 | + targets: x86_64-unknown-linux-gnu |
| 71 | + |
| 72 | + - name: Setup CUDA |
| 73 | + uses: ./.github/actions/linux-setup-cuda |
| 74 | + with: |
| 75 | + cuda_version: '12.4' |
| 76 | + |
| 77 | + - name: Install system dependencies |
| 78 | + run: | |
| 79 | + sudo apt-get update |
| 80 | + sudo apt-get install -y build-essential |
| 81 | +
|
| 82 | + - name: Build |
| 83 | + run: | |
| 84 | + cargo build --release --features cuda --target x86_64-unknown-linux-gnu |
| 85 | +
|
| 86 | + - name: Get version info |
| 87 | + id: version |
| 88 | + run: | |
| 89 | + SHORT_HASH=$(git rev-parse --short=7 HEAD) |
| 90 | + echo "version=${SHORT_HASH}" >> $GITHUB_OUTPUT |
| 91 | +
|
| 92 | + - name: Pack artifacts |
| 93 | + run: | |
| 94 | + mkdir -p release |
| 95 | + tar -czvf vecBox-${{ steps.version.outputs.version }}-bin-linux-cuda-x86_64.tar.gz -C target/x86_64-unknown-linux-gnu/release vecBox |
| 96 | +
|
| 97 | + - name: Upload artifacts |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + path: vecBox-${{ steps.version.outputs.version }}-bin-linux-cuda-x86_64.tar.gz |
| 101 | + name: vecBox-bin-linux-cuda-x86_64.tar.gz |
| 102 | + |
| 103 | + windows-cpu-x64: |
| 104 | + runs-on: windows-2025 |
| 105 | + |
| 106 | + steps: |
| 107 | + - name: Clone |
| 108 | + uses: actions/checkout@v4 |
| 109 | + with: |
| 110 | + fetch-depth: 0 |
| 111 | + |
| 112 | + - name: Install Rust |
| 113 | + uses: dtolnay/rust-toolchain@stable |
| 114 | + with: |
| 115 | + targets: x86_64-pc-windows-msvc |
| 116 | + |
| 117 | + - name: Build |
| 118 | + run: | |
| 119 | + cargo build --release --features mkl --target x86_64-pc-windows-msvc |
| 120 | +
|
| 121 | + - name: Get version info |
| 122 | + id: version |
| 123 | + shell: pwsh |
| 124 | + run: | |
| 125 | + $shortHash = git rev-parse --short=7 HEAD |
| 126 | + echo "version=$shortHash" >> $env:GITHUB_OUTPUT |
| 127 | +
|
| 128 | + - name: Pack artifacts |
| 129 | + shell: pwsh |
| 130 | + run: | |
| 131 | + Compress-Archive -Path target/x86_64-pc-windows-msvc/release/vecBox.exe -DestinationPath vecBox-${{ steps.version.outputs.version }}-bin-win-cpu-x64.zip |
| 132 | +
|
| 133 | + - name: Upload artifacts |
| 134 | + uses: actions/upload-artifact@v4 |
| 135 | + with: |
| 136 | + path: vecBox-${{ steps.version.outputs.version }}-bin-win-cpu-x64.zip |
| 137 | + name: vecBox-bin-win-cpu-x64.zip |
| 138 | + |
| 139 | + windows-cuda-x64: |
| 140 | + runs-on: windows-2022 |
| 141 | + |
| 142 | + env: |
| 143 | + CUDA_PATH: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4' |
| 144 | + CUDA_HOME: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4' |
| 145 | + CUDA_TOOLKIT_ROOT_DIR: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4' |
| 146 | + CUDA_COMPUTE_CAP: '86' |
| 147 | + |
| 148 | + steps: |
| 149 | + - name: Clone |
| 150 | + uses: actions/checkout@v4 |
| 151 | + with: |
| 152 | + fetch-depth: 0 |
| 153 | + |
| 154 | + - name: Install Rust |
| 155 | + uses: dtolnay/rust-toolchain@stable |
| 156 | + with: |
| 157 | + targets: x86_64-pc-windows-msvc |
| 158 | + |
| 159 | + - name: Setup CUDA |
| 160 | + uses: ./.github/actions/windows-setup-cuda |
| 161 | + with: |
| 162 | + cuda_version: '12.4' |
| 163 | + |
| 164 | + - name: Build |
| 165 | + shell: cmd |
| 166 | + run: | |
| 167 | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 |
| 168 | + set PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin;%PATH% |
| 169 | + cargo build --release --features cuda --target x86_64-pc-windows-msvc |
| 170 | +
|
| 171 | + - name: Get version info |
| 172 | + id: version |
| 173 | + shell: pwsh |
| 174 | + run: | |
| 175 | + $shortHash = git rev-parse --short=7 HEAD |
| 176 | + echo "version=$shortHash" >> $env:GITHUB_OUTPUT |
| 177 | +
|
| 178 | + - name: Pack artifacts |
| 179 | + shell: pwsh |
| 180 | + run: | |
| 181 | + Compress-Archive -Path target/x86_64-pc-windows-msvc/release/vecBox.exe -DestinationPath vecBox-${{ steps.version.outputs.version }}-bin-win-cuda-x64.zip |
| 182 | +
|
| 183 | + - name: Upload artifacts |
| 184 | + uses: actions/upload-artifact@v4 |
| 185 | + with: |
| 186 | + path: vecBox-${{ steps.version.outputs.version }}-bin-win-cuda-x64.zip |
| 187 | + name: vecBox-bin-win-cuda-x64.zip |
| 188 | + |
| 189 | + macos-arm64: |
| 190 | + runs-on: macos-14 |
| 191 | + |
| 192 | + steps: |
| 193 | + - name: Clone |
| 194 | + uses: actions/checkout@v4 |
| 195 | + with: |
| 196 | + fetch-depth: 0 |
| 197 | + |
| 198 | + - name: Install Rust |
| 199 | + uses: dtolnay/rust-toolchain@stable |
| 200 | + with: |
| 201 | + targets: aarch64-apple-darwin |
| 202 | + |
| 203 | + - name: Build |
| 204 | + run: | |
| 205 | + cargo build --release --features metal --target aarch64-apple-darwin |
| 206 | +
|
| 207 | + - name: Get version info |
| 208 | + id: version |
| 209 | + run: | |
| 210 | + SHORT_HASH=$(git rev-parse --short=7 HEAD) |
| 211 | + echo "version=${SHORT_HASH}" >> $GITHUB_OUTPUT |
| 212 | +
|
| 213 | + - name: Pack artifacts |
| 214 | + run: | |
| 215 | + mkdir -p release |
| 216 | + tar -czvf vecBox-${{ steps.version.outputs.version }}-bin-macos-arm64.tar.gz -C target/aarch64-apple-darwin/release vecBox |
| 217 | +
|
| 218 | + - name: Upload artifacts |
| 219 | + uses: actions/upload-artifact@v4 |
| 220 | + with: |
| 221 | + path: vecBox-${{ steps.version.outputs.version }}-bin-macos-arm64.tar.gz |
| 222 | + name: vecBox-bin-macos-arm64.tar.gz |
| 223 | + |
| 224 | + macos-x64: |
| 225 | + runs-on: macos-15-intel |
| 226 | + |
| 227 | + steps: |
| 228 | + - name: Clone |
| 229 | + uses: actions/checkout@v4 |
| 230 | + with: |
| 231 | + fetch-depth: 0 |
| 232 | + |
| 233 | + - name: Install Rust |
| 234 | + uses: dtolnay/rust-toolchain@stable |
| 235 | + with: |
| 236 | + targets: x86_64-apple-darwin |
| 237 | + |
| 238 | + - name: Build |
| 239 | + run: | |
| 240 | + cargo build --release --features accelerate --target x86_64-apple-darwin |
| 241 | +
|
| 242 | + - name: Get version info |
| 243 | + id: version |
| 244 | + run: | |
| 245 | + SHORT_HASH=$(git rev-parse --short=7 HEAD) |
| 246 | + echo "version=${SHORT_HASH}" >> $GITHUB_OUTPUT |
| 247 | +
|
| 248 | + - name: Pack artifacts |
| 249 | + run: | |
| 250 | + mkdir -p release |
| 251 | + tar -czvf vecBox-${{ steps.version.outputs.version }}-bin-macos-x64.tar.gz -C target/x86_64-apple-darwin/release vecBox |
| 252 | +
|
| 253 | + - name: Upload artifacts |
| 254 | + uses: actions/upload-artifact@v4 |
| 255 | + with: |
| 256 | + path: vecBox-${{ steps.version.outputs.version }}-bin-macos-x64.tar.gz |
| 257 | + name: vecBox-bin-macos-x64.tar.gz |
0 commit comments