fix: missing cmake and protobuf for windows build, deduplicate sh/pws… (#5028)
Some checks are pending
Canary / Prepare Version (push) Waiting to run
Canary / build-cli (push) Blocked by required conditions
Canary / Upload Install Script (push) Blocked by required conditions
Canary / bundle-desktop (push) Blocked by required conditions
Canary / bundle-desktop-linux (push) Blocked by required conditions
Canary / bundle-desktop-windows (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
CI / changes (push) Waiting to run
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
CI / bundle-desktop-unsigned (push) Blocked by required conditions
Documentation Site Preview / deploy (push) Waiting to run
Publish Docker Image / docker (push) Waiting to run

Signed-off-by: V. Lascik <vlascik@users.noreply.github.com>
This commit is contained in:
vlascik 2025-10-12 21:08:26 +02:00 committed by GitHub
parent 47d5c96ee8
commit 224d486c6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,25 @@ release-binary:
@echo "Generating OpenAPI schema..."
cargo run -p goose-server --bin generate_schema
# release-windows docker build command
win_docker_build_sh := '''rustup target add x86_64-pc-windows-gnu && \
apt-get update && \
apt-get install -y mingw-w64 protobuf-compiler cmake && \
export CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc && \
export CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++ && \
export AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-ar && \
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc && \
export PKG_CONFIG_ALLOW_CROSS=1 && \
export PROTOC=/usr/bin/protoc && \
export PATH=/usr/bin:\$PATH && \
protoc --version && \
cargo build --release --target x86_64-pc-windows-gnu && \
GCC_DIR=\$(ls -d /usr/lib/gcc/x86_64-w64-mingw32/*/ | head -n 1) && \
cp \$GCC_DIR/libstdc++-6.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/ && \
cp \$GCC_DIR/libgcc_s_seh-1.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/ && \
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/
'''
# Build Windows executable
release-windows:
#!/usr/bin/env sh
@ -23,25 +42,16 @@ release-windows:
-v goose-windows-cache:/usr/local/cargo/registry \
-w /usr/src/myapp \
rust:latest \
sh -c "rustup target add x86_64-pc-windows-gnu && \
apt-get update && \
apt-get install -y mingw-w64 protobuf-compiler cmake && \
export CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc && \
export CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++ && \
export AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-ar && \
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc && \
export PKG_CONFIG_ALLOW_CROSS=1 && \
export PROTOC=/usr/bin/protoc && \
export PATH=/usr/bin:\$PATH && \
protoc --version && \
cargo build --release --target x86_64-pc-windows-gnu && \
GCC_DIR=\$(ls -d /usr/lib/gcc/x86_64-w64-mingw32/*/ | head -n 1) && \
cp \$GCC_DIR/libstdc++-6.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/ && \
cp \$GCC_DIR/libgcc_s_seh-1.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/ && \
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/"
sh -c "{{win_docker_build_sh}}"
else
echo "Building Windows executable using Docker through PowerShell..."
powershell.exe -Command "docker volume create goose-windows-cache; docker run --rm -v ${PWD}:/usr/src/myapp -v goose-windows-cache:/usr/local/cargo/registry -w /usr/src/myapp rust:latest sh -c 'rustup target add x86_64-pc-windows-gnu && apt-get update && apt-get install -y mingw-w64 && cargo build --release --target x86_64-pc-windows-gnu && GCC_DIR=\$(ls -d /usr/lib/gcc/x86_64-w64-mingw32/*/ | head -n 1) && cp \$GCC_DIR/libstdc++-6.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/ && cp \$GCC_DIR/libgcc_s_seh-1.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/ && cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /usr/src/myapp/target/x86_64-pc-windows-gnu/release/'"
powershell.exe -Command "docker volume create goose-windows-cache; \`
docker run --rm \`
-v ${PWD}:/usr/src/myapp \`
-v goose-windows-cache:/usr/local/cargo/registry \`
-w /usr/src/myapp \`
rust:latest \`
sh -c '{{win_docker_build_sh}}'"
fi
echo "Windows executable and required DLLs created at ./target/x86_64-pc-windows-gnu/release/"
@ -128,14 +138,18 @@ copy-binary-windows:
} else { \
Write-Host 'Windows goose-scheduler-executor binary not found.' -ForegroundColor Yellow; \
}"
@if [ -f ./temporal-service/temporal-service.exe ]; then \
echo "Copying Windows temporal-service binary..."; \
cp -p ./temporal-service/temporal-service.exe ./ui/desktop/src/bin/; \
else \
echo "Windows temporal-service binary not found. Building it..."; \
cd temporal-service && GOOS=windows GOARCH=amd64 go build -o temporal-service.exe main.go && cp temporal-service.exe ../ui/desktop/src/bin/; \
fi
@echo "Note: Temporal CLI for Windows will be downloaded at runtime if needed"
@powershell.exe -Command "if (Test-Path './temporal-service/temporal-service.exe') { \
Write-Host 'Copying Windows temporal-service binary...'; \
Copy-Item -Path './temporal-service/temporal-service.exe' -Destination './ui/desktop/src/bin/' -Force; \
} else { \
Write-Host 'Windows temporal-service binary not found. Building it...'; \
Push-Location 'temporal-service'; \
$env:GOOS='windows'; $env:GOARCH='amd64'; \
go build -o temporal-service.exe main.go; \
Copy-Item -Path 'temporal-service.exe' -Destination '../ui/desktop/src/bin/' -Force; \
Pop-Location; \
}"
@powershell.exe -Command "Write-Host 'Note: Temporal CLI for Windows will be downloaded at runtime if needed'"
# Run UI with latest
run-ui: