Windows Non avx2 and portable #53
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: Windows Non avx2, cuda, portable | |
on: | |
workflow_dispatch: | |
inputs: | |
skip-publish: | |
required: false | |
default: '0' | |
debug: | |
required: false | |
default: '0' | |
jobs: | |
publish-tauri: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Windows no AVX2 | |
- platform: "windows-latest" | |
args: '--features="opencl"' | |
pre-build-args: "--older-cpu --opencl" | |
name: "older-cpu" | |
rust-version: "stable" | |
# Windows cuda 12.5.0 | |
- platform: "windows-latest" | |
args: '--features="cuda"' | |
pre-build-args: "--cuda" | |
name: 'nvidia-12.5.0' | |
cuda-verison: '12.5.0' | |
rust-version: "stable" | |
# Windows cuda 11.8.0 | |
- platform: "windows-latest" | |
args: '--features="cuda"' | |
pre-build-args: "--cuda" | |
name: 'nvidia-11.8.0' | |
cuda-verison: '11.8.0' | |
rust-version: "stable" | |
# Windows portable | |
- platform: "windows-latest" # Windows x86_64 | |
args: '--features="opencl"' | |
pre-build-args: "--portable --opencl" | |
name: portable | |
rust-version: "stable" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Setup CUDA Toolkit | |
if: contains(matrix.args, 'cuda') | |
id: cuda-toolkit | |
shell: pwsh | |
run: scripts/setup_cuda.ps1 | |
env: | |
INPUT_CUDA_VERSION: ${{ matrix.cuda-verison }} | |
- name: setup Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install frontend dependencies | |
run: bun install | |
working-directory: ./desktop | |
# Run pre build | |
- name: Run pre_build.js | |
run: bun scripts/pre_build.js ${{ matrix.pre-build-args }} | |
- name: Build | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
BUILD_DEBUG: ${{ github.event.inputs.debug }} | |
with: | |
projectPath: "./desktop" | |
tauriScript: bunx tauri | |
args: ${{ matrix.args }} | |
- name: Prepare Portable zip | |
if: contains(matrix.name, 'portable') | |
run: | | |
# Get all EXE files in the specified directory | |
$exe_files = Get-ChildItem -Path "target\release\bundle\nsis\*.exe" | |
# Unzip each EXE file and zip the contents | |
foreach ($file in $exe_files) { | |
$name = $file.BaseName | |
$ext = "_portable.zip" | |
# Create a new directory for extraction in the same folder | |
$extract_dir = New-Item -ItemType Directory -Path "$($file.DirectoryName)\$name" | |
echo $extract_dir.FullName | |
try { | |
# Unzip the EXE file into the new directory | |
& 7z x $file.FullName -o"$extract_dir" | |
# Zip the contents into a new zip file | |
$zip_name = "{0}{1}" -f $name, $ext | |
& 7z a "$($file.DirectoryName)\$zip_name" "$extract_dir\*" | |
Write-Output "Zipped contents of '$($file.FullName)' to '$zip_name'" | |
} finally { | |
# Remove the extraction directory | |
Remove-Item -Recurse -Force $extract_dir | |
} | |
} | |
shell: pwsh | |
- name: Rename Installer | |
if: ${{ !contains(matrix.name, 'portable') }} | |
run: | | |
# Get the list of exe files in the directory | |
$exe_files = Get-ChildItem -Path "target\release\bundle\nsis\*.exe" | |
# Rename each exe file | |
foreach ($file in $exe_files) { | |
# Split the file name and extension | |
$name = $file.BaseName | |
$ext = $file.Extension | |
# New file name | |
$suffix = "${{ matrix.name }}" | |
$new_name = "{0}_{1}{2}" -f $name, $suffix, $ext | |
# Rename the file | |
Rename-Item -Path $file.FullName -NewName $new_name | |
Write-Output "Renamed '$($file.FullName)' to '$new_name'" | |
} | |
shell: pwsh | |
- name: Upload installer | |
if: github.event.inputs.skip-publish != '1' | |
run: | | |
$filePattern = '${{ matrix.name }}' -match 'portable' ? '*.zip' : '*.exe' | |
bun scripts/publish.js target/release/bundle/nsis/$filePattern | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEBUG: ${{ github.event.inputs.debug }} |