Windows Non avx2 and portable #88
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 and portable | |
on: | |
workflow_dispatch: | |
inputs: | |
skip-publish: | |
required: false | |
default: '0' | |
debug: | |
required: false | |
default: '0' | |
cargo_args: | |
required: false | |
default: "" | |
jobs: | |
publish: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Windows no AVX2 | |
- platform: "windows-latest" | |
args: '' | |
pre-build-args: "--older-cpu" | |
name: "older-cpu" | |
rust-version: "stable" | |
# Windows no AVX2 | |
- platform: "windows-latest" | |
args: '--features="vulkan"' | |
pre-build-args: "--older-cpu --vulkan" | |
name: "older-cpu-vulkan" | |
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="vulkan"' | |
pre-build-args: "--portable --vulkan" | |
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: Prepare Vulkan SDK for Linux | |
run: | | |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc | |
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list http://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list | |
sudo apt update | |
sudo apt install vulkan-sdk -y | |
sudo apt-get install -y mesa-vulkan-drivers | |
if: ${{ contains(matrix.platform, 'ubuntu') && contains(matrix.args, 'vulkan') }} | |
- 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: | |
GH_TOKEN: ${{ secrets.GH_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 }} ${{ github.event.inputs.cargo_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: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
DEBUG: ${{ github.event.inputs.debug }} |