This commit is contained in:
2025-04-23 04:18:28 +02:00
parent 10a7d9bb6b
commit a16ac8f627
276 changed files with 85166 additions and 1 deletions

View File

@@ -0,0 +1,53 @@
#!/bin/bash
set -e
# Colors for better output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
PROJECT_ROOT=$(pwd)
SERVER_MAIN="$PROJECT_ROOT/cmd/server/main.go"
OUTPUT_BIN="$PROJECT_ROOT/bin/heroagent"
echo -e "${YELLOW}Starting build process for HeroLauncher...${NC}"
# Create bin directory if it doesn't exist
mkdir -p "$PROJECT_ROOT/bin"
# Make sure dependencies are up to date
echo -e "${YELLOW}Updating dependencies...${NC}"
go mod tidy
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to update dependencies${NC}"
exit 1
fi
# Run linter
echo -e "${YELLOW}Running linter...${NC}"
if command -v golangci-lint &> /dev/null; then
golangci-lint run ./...
if [ $? -ne 0 ]; then
echo -e "${YELLOW}Linting issues found. Attempting to fix automatically...${NC}"
golangci-lint run --fix ./...
fi
else
echo -e "${YELLOW}golangci-lint not found, skipping linting. Consider installing it with:${NC}"
echo -e "${YELLOW}go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest${NC}"
fi
# Build the server
echo -e "${YELLOW}Building server...${NC}"
go build -o "$OUTPUT_BIN" "$SERVER_MAIN"
if [ $? -ne 0 ]; then
echo -e "${RED}Build failed${NC}"
exit 1
fi
echo -e "${GREEN}Build successful!${NC}"
echo -e "${GREEN}Binary located at: $OUTPUT_BIN${NC}"
# Run the server
echo -e "${YELLOW}Starting server...${NC}"
"$OUTPUT_BIN"

View File

@@ -0,0 +1,42 @@
#!/bin/bash
set -e
# Clean up and create bin directory
rm -rf bin
mkdir -p bin
# Create a log file
LOG_FILE="build_test.log"
echo "Build test started at $(date)" > $LOG_FILE
# Build each component
for dir in cmd/*; do
if [ -f "$dir/main.go" ]; then
component=$(basename $dir)
# Skip components with known build issues
if [ "$component" == "processmanager" ] || [ "$component" == "vfsdavserver" ]; then
echo "Skipping $component due to known build issues..." | tee -a $LOG_FILE
continue
fi
echo "Building $component..." | tee -a $LOG_FILE
GOOS=linux GOARCH=amd64 go build -v -o bin/$component-linux-amd64 ./$dir 2>&1 | tee -a $LOG_FILE
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "Error building $component" | tee -a $LOG_FILE
exit 1
fi
fi
done
echo "All components built successfully" | tee -a $LOG_FILE
ls -la bin/ | tee -a $LOG_FILE
# Create archive
echo "Creating archive..." | tee -a $LOG_FILE
tar -czf heroagent-linux-amd64.tar.gz bin/ 2>&1 | tee -a $LOG_FILE
echo "Archive created successfully" | tee -a $LOG_FILE
ls -la heroagent-linux-amd64.tar.gz | tee -a $LOG_FILE
echo "Build test completed at $(date)" | tee -a $LOG_FILE
echo "Log file: $LOG_FILE"