fix: bundle CUDA DLL into the release #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- "*" | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
accelerator: ["cublas", "clblast"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: "./apps/desktop/src-tauri -> target" | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: "latest" | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Install CLBlast on linux | |
if: matrix.accelerator == 'clblast' | |
run: sudo apt install libclblast-dev | |
- uses: Jimver/[email protected] | |
name: Install CUDA toolkit on Linux | |
if: matrix.accelerator == 'cublas' | |
id: cuda-toolkit-linux | |
with: | |
cuda: "12.2.0" | |
method: "network" | |
#See e.g. https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ | |
non-cuda-sub-packages: '["libcublas","libcublas-dev"]' | |
sub-packages: '["nvcc","compiler","libraries","libraries-dev","cudart","cudart-dev"]' | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: run pnpm | |
run: | | |
pnpm i | |
pnpm build:sdk | |
- name: Change directory to tauri path | |
run: | | |
cd apps | |
cd desktop | |
- name: Get release infos | |
id: release_infos | |
run: | | |
echo "release_body=${{ github.event.release.body || 'Default release body' }}" >> $GITHUB_OUTPUT | |
echo "release_id=${{ github.event.release.id || 'default_id' }}" >> $GITHUB_OUTPUT | |
echo "tag_name=${{ github.event.release.tag_name || 'default_tag' }}" >> $GITHUB_OUTPUT | |
- name: Build the app | |
id: tauri_action | |
uses: tauri-apps/tauri-action@dev | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_PROVIDER_SHORT_NAME: ${{ secrets.APPLE_PROVIDER_SHORT_NAME }} | |
with: | |
prerelease: false | |
releaseDraft: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
releaseName: "v__VERSION__" | |
releaseBody: ${{ steps.release_infos.outputs.release_body }} | |
releaseId: ${{ steps.release_infos.outputs.release_id }} | |
tagName: ${{ steps.release_infos.outputs.tag_name }} | |
args: "--features ${{ matrix.accelerator }}" | |
- name: List Artifacts | |
run: | | |
echo ${{steps.tauri_action.outputs.artifactPaths}} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "linux-${{ matrix.accelerator }}" | |
if-no-files-found: error | |
path: | | |
src-tauri/target/release/bundle/**/*.dep | |
src-tauri/target/release/bundle/**/*.AppImage* | |
windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
accelerator: ["cublas", "clblast"] | |
runs-on: windows-latest | |
steps: | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: "./apps/desktop/src-tauri -> target" | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: "latest" | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Install vcpkg on windows | |
if: matrix.accelerator == 'clblast' | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git | |
cd vcpkg | |
./bootstrap-vcpkg.sh | |
ls -la | |
shell: bash | |
- name: Install OpenCL on windows | |
if: matrix.accelerator == 'clblast' | |
run: | | |
${{ github.workspace }}\vcpkg\vcpkg.exe install opencl:x64-windows | |
shell: pwsh | |
- name: Install CLBlast on windows | |
if: matrix.accelerator == 'clblast' | |
run: | | |
${{ github.workspace }}\vcpkg\vcpkg.exe install clblast:x64-windows | |
shell: pwsh | |
- name: Set Windows Environment Variables | |
if: matrix.accelerator == 'clblast' | |
run: | | |
echo "CLBLAST_PATH=${{ github.workspace }}/vcpkg/packages/clblast_x64-windows" >> $GITHUB_ENV | |
echo "OPENCL_PATH=${{ github.workspace }}/vcpkg/packages/opencl_x64-windows" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/vcpkg/packages/clblast_x64-windows/bin" >> $GITHUB_PATH | |
echo "${{ github.workspace }}/vcpkg/packages/opencl_x64-windows/bin" >> $GITHUB_PATH | |
shell: bash | |
- uses: Jimver/[email protected] | |
name: Install CUDA toolkit on Windows | |
if: matrix.accelerator == 'cublas' | |
id: cuda-toolkit-windows | |
with: | |
cuda: "12.2.0" | |
#See https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#install-the-cuda-software | |
method: "local" | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: run pnpm | |
run: | | |
pnpm i | |
pnpm build:sdk | |
- name: Change directory to tauri path | |
run: | | |
cd apps | |
cd desktop | |
- name: Get release infos | |
id: release_infos | |
run: | | |
echo "release_body=${{ github.event.release.body || 'Default release body' }}" >> $GITHUB_OUTPUT | |
echo "release_id=${{ github.event.release.id || 'default_id' }}" >> $GITHUB_OUTPUT | |
echo "tag_name=${{ github.event.release.tag_name || 'default_tag' }}" >> $GITHUB_OUTPUT | |
- name: Build the app | |
id: tauri_action | |
uses: tauri-apps/tauri-action@dev | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_PROVIDER_SHORT_NAME: ${{ secrets.APPLE_PROVIDER_SHORT_NAME }} | |
with: | |
prerelease: false | |
releaseDraft: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
releaseName: "v__VERSION__" | |
releaseBody: ${{ steps.release_infos.outputs.release_body }} | |
releaseId: ${{ steps.release_infos.outputs.release_id }} | |
tagName: ${{ steps.release_infos.outputs.tag_name }} | |
args: "--features ${{ matrix.accelerator }}" | |
- name: List Artifacts | |
run: | | |
echo ${{steps.tauri_action.outputs.artifactPaths}} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "windows-${{ matrix.accelerator }}" | |
if-no-files-found: error | |
path: | | |
src-tauri/target/release/bundle/**/*.exe | |
src-tauri/target/release/bundle/**/*.msi |