Skip to content

Commit 04263a3

Browse files
committed
fix: Apply Windows linker fix globally for all Rust builds
- Configure cargo globally in user's .cargo/config.toml - Remove Git usr/bin from PATH once for entire job - Use PowerShell for Windows Tauri build to respect PATH changes - This fixes link.exe issues for both standalone and Tauri builds
1 parent c9b9864 commit 04263a3

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

.github/workflows/build-local-agent.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,7 @@ jobs:
4545
sparse-checkout: |
4646
lambda/tools/local-agent
4747
48-
# Remove Git usr/bin from PATH FIRST to avoid link.exe conflict
49-
- name: Remove Git usr/bin from PATH (Windows)
50-
if: matrix.win
51-
shell: pwsh
52-
run: |
53-
$env:PATH = ($env:PATH -split ';' | Where-Object {$_ -notmatch 'Git\\usr\\bin'} ) -join ';'
54-
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
55-
56-
# Windows needs MSVC - setup proper environment AFTER removing Git from PATH
48+
# Windows needs MSVC - setup proper environment
5749
- name: Setup MSVC (Windows)
5850
if: matrix.win
5951
uses: ilammy/msvc-dev-cmd@v1
@@ -76,13 +68,21 @@ jobs:
7668
- name: Configure cargo linker (Windows)
7769
if: matrix.win
7870
shell: pwsh
79-
working-directory: lambda/tools/local-agent/rust-executor-standalone
8071
run: |
81-
New-Item -ItemType Directory -Force .cargo | Out-Null
72+
# Create cargo config in home directory to apply globally
73+
$cargoDir = "$env:USERPROFILE\.cargo"
74+
New-Item -ItemType Directory -Force $cargoDir | Out-Null
8275
@"
8376
[target.x86_64-pc-windows-msvc]
8477
linker = "link.exe"
85-
"@ | Set-Content .cargo/config.toml -Encoding UTF8
78+
79+
[env]
80+
RUSTFLAGS = "-C target-feature=+crt-static"
81+
"@ | Set-Content "$cargoDir\config.toml" -Encoding UTF8
82+
83+
# Also remove Git from PATH globally for this job
84+
$env:PATH = ($env:PATH -split ';' | Where-Object {$_ -notmatch 'Git\\usr\\bin'} ) -join ';'
85+
echo "PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
8686
8787
# Verify the correct linker is being used
8888
- name: Check linker (Windows)
@@ -129,8 +129,19 @@ jobs:
129129
cp ../src-tauri/src/rust_automation.rs src/
130130
cargo build --release --target "${{ matrix.target }}"
131131
132-
# Build Tauri GUI app
133-
- name: Build Tauri GUI
132+
# Build Tauri GUI app - Windows
133+
- name: Build Tauri GUI (Windows)
134+
if: matrix.win
135+
working-directory: lambda/tools/local-agent
136+
shell: pwsh
137+
run: npm run tauri build -- --target ${{ matrix.target }}
138+
env:
139+
TAURI_SIGNING_PRIVATE_KEY: ""
140+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
141+
142+
# Build Tauri GUI app - Unix
143+
- name: Build Tauri GUI (Unix)
144+
if: matrix.win != true
134145
working-directory: lambda/tools/local-agent
135146
run: npm run tauri build -- --target ${{ matrix.target }}
136147
shell: bash

0 commit comments

Comments
 (0)