11name : ' Setup Tauri Build Environment'
2- description : ' Install Node.js, Rust, and frontend deps for Tauri builds'
2+ description : ' Install Task, Node.js, and platform deps for Tauri builds'
33
44inputs :
55 node-version :
@@ -9,72 +9,30 @@ inputs:
99runs :
1010 using : ' composite'
1111 steps :
12- - name : Add Homebrew to PATH
12+ - name : Setup macOS self-hosted runner PATH
1313 if : runner.os == 'macOS'
1414 shell : bash
15- run : echo "/opt/homebrew/bin:/opt/homebrew/sbin" >> $GITHUB_PATH
16-
17- - name : Install macOS system dependencies
18- if : runner.os == 'macOS'
19- shell : bash
20- run : |
21- export HOMEBREW_NO_AUTO_UPDATE=1
22- brew list cmake &>/dev/null && echo "cmake already installed" || brew install cmake
23-
24- - name : Install Linux system dependencies
25- if : runner.os == 'Linux'
26- shell : bash
2715 run : |
28- sudo apt-get update
29- sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file \
30- libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev \
31- libasound2-dev cmake zlib1g-dev libgtk-3-dev
16+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
17+ echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
18+ echo "/opt/homebrew/bin:/opt/homebrew/sbin" >> $GITHUB_PATH
3219
33- - name : Install Windows system dependencies
20+ - name : Setup Windows PATH
3421 if : runner.os == 'Windows'
3522 shell : pwsh
3623 run : |
37- choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
38- choco install rustup.install -y
24+ echo "$env:USERPROFILE\.cargo\bin" >> $env:GITHUB_PATH
25+ $gitPath = (Get-ItemProperty 'HKLM:\SOFTWARE\GitForWindows' -ErrorAction SilentlyContinue).InstallPath
26+ if ($gitPath) { echo "$gitPath\usr\bin" >> $env:GITHUB_PATH }
3927
4028 - name : Install Task
4129 uses : go-task/setup-task@v1
4230
4331 - name : Setup Node.js
44- uses : actions/setup-node@v6
32+ uses : actions/setup-node@v4
4533 with :
4634 node-version : ${{ inputs.node-version }}
4735
48- - name : Setup Rust (non-Windows)
49- if : runner.os != 'Windows'
50- uses : actions-rust-lang/setup-rust-toolchain@v1
51- with :
52- toolchain : stable
53-
54- - name : Setup Rust (Windows)
55- if : runner.os == 'Windows'
56- shell : pwsh
57- run : |
58- # Refresh PATH to pick up choco-installed rustup
59- Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
60- refreshenv
61- # Ensure rustup-managed binaries take precedence over chocolatey
62- $cargobin = Join-Path $env:USERPROFILE '.cargo\bin'
63- echo $cargobin >> $env:GITHUB_PATH
64- # Pin nightly toolchain via env var (overrides any default)
65- echo "RUSTUP_TOOLCHAIN=nightly-2026-02-09" >> $env:GITHUB_ENV
66- rustup toolchain install nightly-2026-02-09 --no-self-update --target x86_64-pc-windows-msvc
67- rustup default nightly-2026-02-09
68- # Parallelism: match build.ps1 settings
69- $cpus = [Environment]::ProcessorCount
70- $buildJobs = [Math]::Max(1, $cpus - 2)
71- $rustThreads = [Math]::Max(1, [Math]::Round($cpus * 0.8))
72- echo "CARGO_BUILD_JOBS=$buildJobs" >> $env:GITHUB_ENV
73- echo "RUSTFLAGS=-Zthreads=$rustThreads" >> $env:GITHUB_ENV
74- echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=$rustThreads" >> $env:GITHUB_ENV
75- rustc --version
76- cargo --version
77-
7836 - name : Install frontend dependencies (non-Windows)
7937 if : runner.os != 'Windows'
8038 shell : bash
8644 shell : pwsh
8745 working-directory : ./app/frontend
8846 run : npm ci
47+
48+ - name : Restore Taskfile fingerprint cache
49+ uses : actions/cache@v4
50+ with :
51+ path : .task
52+ key : task-${{ runner.os }}-${{ hashFiles('taskfiles/ci.yml') }}
53+ restore-keys : |
54+ task-${{ runner.os }}-
55+
56+ - name : Setup CI environment (macOS/Linux)
57+ if : runner.os != 'Windows'
58+ shell : bash
59+ run : task ci:setup
60+
61+ - name : Install system dependencies (Windows)
62+ if : runner.os == 'Windows'
63+ shell : pwsh
64+ run : |
65+ $ProgressPreference = 'SilentlyContinue'
66+ # VC++ runtime must come first — choco NSIS installers (rustup-init.exe, etc.)
67+ # require it to launch and fail with SxS errors on bare Server 2019 without it.
68+ $out = Join-Path $env:TEMP 'vc_redist.x64.exe'
69+ (New-Object Net.WebClient).DownloadFile('https://aka.ms/vs/17/release/vc_redist.x64.exe', $out)
70+ $proc = Start-Process -FilePath $out -ArgumentList '/install','/quiet','/norestart' -Wait -PassThru
71+ # 0=success 1638=already installed 3010=reboot needed (safe to ignore in CI)
72+ if ($proc.ExitCode -notin @(0, 1638, 3010)) { exit $proc.ExitCode }
73+
74+ $toInstall = @()
75+ if (-not (Get-Command cmake -ErrorAction SilentlyContinue)) { $toInstall += 'cmake' }
76+ if (-not (Get-Command 7z -ErrorAction SilentlyContinue)) { $toInstall += '7zip' }
77+ if ($toInstall.Count -gt 0) {
78+ choco install @toInstall -y
79+ if ($toInstall -contains 'cmake') {
80+ echo "$env:ProgramFiles\CMake\bin" >> $env:GITHUB_PATH
81+ }
82+ }
83+
84+ # rustup via direct download — choco spawns a grandchild process whose SxS
85+ # activation context predates the vc_redist install above, causing a
86+ # side-by-side configuration error. A direct Start-Process call works.
87+ if (-not (Get-Command rustup -ErrorAction SilentlyContinue)) {
88+ $rustupInit = Join-Path $env:TEMP 'rustup-init.exe'
89+ (New-Object Net.WebClient).DownloadFile(
90+ 'https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe',
91+ $rustupInit
92+ )
93+ $proc = Start-Process -FilePath $rustupInit `
94+ -ArgumentList '-y','--default-toolchain','none','--no-modify-path' `
95+ -Wait -PassThru
96+ if ($proc.ExitCode -ne 0) { exit $proc.ExitCode }
97+ }
98+
99+ - name : Install cargo-binstall (Windows)
100+ if : runner.os == 'Windows'
101+ shell : pwsh
102+ run : |
103+ if (-not (Get-Command cargo-binstall -ErrorAction SilentlyContinue)) {
104+ $zip = Join-Path $env:TEMP "cargo-binstall.zip"
105+ $bin = Join-Path $env:USERPROFILE ".cargo\bin"
106+ $url = "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-pc-windows-msvc.zip"
107+ New-Item -ItemType Directory -Force -Path $bin | Out-Null
108+ (New-Object Net.WebClient).DownloadFile($url, $zip)
109+ Expand-Archive -Path $zip -DestinationPath $bin -Force
110+ Remove-Item $zip
111+ }
112+
113+ - name : Setup CI environment (Windows)
114+ if : runner.os == 'Windows'
115+ shell : pwsh
116+ run : task ci:setup
117+
118+ - name : Windows Defender exclusions
119+ if : runner.os == 'Windows'
120+ shell : pwsh
121+ run : |
122+ Add-MpPreference -ExclusionPath "$env:USERPROFILE\.cargo"
123+ Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE"
124+ Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE\target"
125+
126+ - name : Cargo cache (Linux/Windows runners)
127+ if : runner.os == 'Linux' || runner.os == 'Windows'
128+ uses : Swatinem/rust-cache@v2
129+ with :
130+ cache-on-failure : " true"
131+ env :
132+ CARGO_INCREMENTAL : " 0"
0 commit comments