Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 37 additions & 35 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Platform Build Strategy:
# - Linux: Uses Ubuntu runner with cross-compilation
# - macOS: Uses macOS runner with cross-compilation
# - macOS: Uses macOS runner with cross-compilation
# - Windows: Uses Ubuntu runner with Docker cross-compilation (same as desktop build)
on:
workflow_call:
Expand Down Expand Up @@ -35,11 +35,13 @@ jobs:
target-suffix: unknown-linux-gnu
build-on: ubuntu-latest
use-cross: true
cc: gcc-10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like latest stable version of gcc is 15. could we update all the way to newest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite possibly, yeah. I went with 10 because ubuntu 20 (what we're building on) ships with 9, and 10 is where the original issue is fixed: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189

according to some googling though, 10 is the latest in the official repositories for ubuntu 20 (I haven't verified) so it might mean some extra steps to get it working for not much gain

- os: ubuntu-latest
architecture: aarch64
target-suffix: unknown-linux-gnu
build-on: ubuntu-latest
use-cross: true
cc: gcc-10
# macOS builds
- os: macos-latest
architecture: x86_64
Expand Down Expand Up @@ -123,17 +125,17 @@ jobs:
echo "Cross version:"
cross --version

echo "Building with explicit PROTOC path..."
cross build --release --target ${TARGET} -p goose-cli -vv
export CC="${{ matrix.cc || ''}}"
cross build --release --target ${TARGET} -p goose-cli

- name: Build CLI (Windows)
if: matrix.use-docker
run: |
echo "🚀 Building Windows CLI executable with enhanced GitHub Actions caching..."

# Create cache directories
mkdir -p ~/.cargo/registry ~/.cargo/git

# Use enhanced caching with GitHub Actions cache mounts
docker run --rm \
-v "$(pwd)":/usr/src/myapp \
Expand All @@ -146,27 +148,27 @@ jobs:
echo '=== Setting up Rust environment with caching ==='
export CARGO_HOME=/usr/local/cargo
export PATH=/usr/local/cargo/bin:\$PATH

# Check if Windows target is already installed in cache
if rustup target list --installed | grep -q x86_64-pc-windows-gnu; then
echo '✅ Windows cross-compilation target already installed'
else
echo '📦 Installing Windows cross-compilation target...'
rustup target add x86_64-pc-windows-gnu
fi

echo '=== Setting up build dependencies ==='
apt-get update
apt-get install -y mingw-w64 protobuf-compiler cmake time

echo '=== Setting up cross-compilation environment ==='
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

echo '=== Optimized Cargo configuration ==='
mkdir -p .cargo
echo '[build]' > .cargo/config.toml
Expand All @@ -188,7 +190,7 @@ jobs:
echo '' >> .cargo/config.toml
echo '[registries.crates-io]' >> .cargo/config.toml
echo 'protocol = \"sparse\"' >> .cargo/config.toml

echo '=== Building with cached dependencies ==='
# Check if we have cached build artifacts
if [ -d target/x86_64-pc-windows-gnu/release/deps ] && [ \"\$(ls -A target/x86_64-pc-windows-gnu/release/deps)\" ]; then
Expand All @@ -198,34 +200,34 @@ jobs:
echo '🔨 No cached artifacts found, performing full build...'
CARGO_INCREMENTAL=0
fi

echo '🔨 Building Windows CLI executable...'
CARGO_INCREMENTAL=\$CARGO_INCREMENTAL \
CARGO_NET_RETRY=3 \
CARGO_HTTP_TIMEOUT=60 \
RUST_BACKTRACE=1 \
cargo build --release --target x86_64-pc-windows-gnu -p goose-cli --jobs 4

echo '=== Copying Windows runtime DLLs ==='
GCC_DIR=\$(ls -d /usr/lib/gcc/x86_64-w64-mingw32/*/ | head -n 1)
cp \"\$GCC_DIR/libstdc++-6.dll\" target/x86_64-pc-windows-gnu/release/
cp \"\$GCC_DIR/libgcc_s_seh-1.dll\" target/x86_64-pc-windows-gnu/release/
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll target/x86_64-pc-windows-gnu/release/

echo '✅ Build completed successfully!'
ls -la target/x86_64-pc-windows-gnu/release/
"

# Verify build succeeded
if [ ! -f "./target/x86_64-pc-windows-gnu/release/goose.exe" ]; then
echo "❌ Windows CLI binary not found."
ls -la ./target/x86_64-pc-windows-gnu/release/ || echo "Release directory doesn't exist"
exit 1
fi

echo "✅ Windows CLI binary found!"
ls -la ./target/x86_64-pc-windows-gnu/release/goose.exe

echo "✅ Windows runtime DLLs:"
ls -la ./target/x86_64-pc-windows-gnu/release/*.dll

Expand All @@ -234,7 +236,7 @@ jobs:
run: |
source ./bin/activate-hermit
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"

# Set Go cross-compilation variables based on target
case "${TARGET}" in
"x86_64-unknown-linux-gnu")
Expand Down Expand Up @@ -262,7 +264,7 @@ jobs:
exit 1
;;
esac

echo "Building temporal-service for ${GOOS}/${GOARCH} using build.sh script..."
cd temporal-service
# Run build.sh with cross-compilation environment
Expand All @@ -284,11 +286,11 @@ jobs:
chmod +x build.sh
# Set Windows build environment and run build script
GOOS=windows GOARCH=amd64 ./build.sh

# Move the built binary to the expected location (inside container)
mkdir -p ../target/x86_64-pc-windows-gnu/release
mv temporal-service.exe ../target/x86_64-pc-windows-gnu/release/temporal-service.exe

# Fix permissions for host access
chmod -R 755 ../target/x86_64-pc-windows-gnu
"
Expand All @@ -299,7 +301,7 @@ jobs:
run: |
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
TEMPORAL_VERSION="1.3.0"

# Set platform-specific download parameters
case "${TARGET}" in
"x86_64-unknown-linux-gnu")
Expand Down Expand Up @@ -327,18 +329,18 @@ jobs:
exit 1
;;
esac

echo "Downloading temporal CLI for ${TEMPORAL_OS}/${TEMPORAL_ARCH}..."
TEMPORAL_FILE="temporal_cli_${TEMPORAL_VERSION}_${TEMPORAL_OS}_${TEMPORAL_ARCH}.tar.gz"
curl -L "https://github.com/temporalio/cli/releases/download/v${TEMPORAL_VERSION}/${TEMPORAL_FILE}" -o "${TEMPORAL_FILE}"

# Extract temporal CLI
tar -xzf "${TEMPORAL_FILE}"
chmod +x temporal${TEMPORAL_EXT}

# Move to target directory
mv temporal${TEMPORAL_EXT} "target/${TARGET}/release/temporal${TEMPORAL_EXT}"

# Clean up
rm -f "${TEMPORAL_FILE}"
echo "temporal CLI downloaded successfully for ${TARGET}"
Expand All @@ -351,13 +353,13 @@ jobs:
curl -L "https://github.com/temporalio/cli/releases/download/v${TEMPORAL_VERSION}/temporal_cli_${TEMPORAL_VERSION}_windows_amd64.zip" -o temporal-cli-windows.zip
unzip -o temporal-cli-windows.zip
chmod +x temporal.exe

# Fix permissions on target directory (created by Docker as root)
sudo chown -R $(whoami):$(whoami) target/x86_64-pc-windows-gnu/ || true

# Move to target directory
mv temporal.exe target/x86_64-pc-windows-gnu/release/temporal.exe

# Clean up
rm -f temporal-cli-windows.zip
echo "temporal CLI downloaded successfully for Windows"
Expand All @@ -367,15 +369,15 @@ jobs:
run: |
source ./bin/activate-hermit
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"

# Create a directory for the package contents
mkdir -p "target/${TARGET}/release/goose-package"

# Copy binaries
cp "target/${TARGET}/release/goose" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal-service" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal" "target/${TARGET}/release/goose-package/"

# Create the tar archive with all binaries
cd "target/${TARGET}/release"
tar -cjf "goose-${TARGET}.tar.bz2" -C goose-package .
Expand All @@ -385,18 +387,18 @@ jobs:
if: matrix.use-docker
run: |
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"

# Create a directory for the package contents
mkdir -p "target/${TARGET}/release/goose-package"

# Copy binaries
cp "target/${TARGET}/release/goose.exe" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal-service.exe" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal.exe" "target/${TARGET}/release/goose-package/"

# Copy Windows runtime DLLs
cp "target/${TARGET}/release/"*.dll "target/${TARGET}/release/goose-package/"

# Create the zip archive with all binaries and DLLs
cd "target/${TARGET}/release"
zip -r "goose-${TARGET}.zip" goose-package/
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/bundle-desktop-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
RUST_LOG: debug
RUST_BACKTRACE: 1
CROSS_VERBOSE: 1
CC: gcc-10
run: |
source ./bin/activate-hermit
export TARGET="x86_64-unknown-linux-gnu"
Expand Down Expand Up @@ -157,10 +158,10 @@ jobs:
source ./bin/activate-hermit
cd ui/desktop
echo "Building Linux packages (.deb and .rpm)..."

# Build both .deb and .rpm packages
npm run make -- --platform=linux --arch=x64

echo "Build completed. Checking output..."
ls -la out/
find out/ -name "*.deb" -o -name "*.rpm" | head -10
Expand Down
32 changes: 7 additions & 25 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Configuration for cross-compiling using cross
[build.env]
passthrough = [ "CC" ]

[target.aarch64-unknown-linux-gnu]
xargo = false
pre-build = [
Expand All @@ -11,15 +14,8 @@ pre-build = [
pkg-config \
libssl-dev:arm64 \
libdbus-1-dev:arm64 \
libxcb1-dev:arm64
""",
"""\
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \
unzip -o protoc-31.1-linux-x86_64.zip -d /usr/local && \
chmod +x /usr/local/bin/protoc && \
ln -sf /usr/local/bin/protoc /usr/bin/protoc && \
which protoc && \
protoc --version
libxcb1-dev:arm64 \
gcc-10
"""
]

Expand All @@ -33,15 +29,8 @@ pre-build = [
pkg-config \
libssl-dev \
libdbus-1-dev \
libxcb1-dev
""",
"""\
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \
unzip -o protoc-31.1-linux-x86_64.zip -d /usr/local && \
chmod +x /usr/local/bin/protoc && \
ln -sf /usr/local/bin/protoc /usr/bin/protoc && \
which protoc && \
protoc --version
libxcb1-dev \
gcc-10
"""
]

Expand All @@ -53,12 +42,5 @@ pre-build = [
apt-get update && apt-get install -y \
curl \
unzip
""",
"""\
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \
unzip protoc-31.1-linux-x86_64.zip -d /usr/local && \
chmod +x /usr/local/bin/protoc && \
export PROTOC=/usr/local/bin/protoc && \
protoc --version
"""
]
Loading