name: Unreal Engine Build on: workflow_dispatch: push: branches: [ main, develop ] jobs: # windows-build: # runs-on: windows # steps: # - name: Checkout repository # uses: actions/checkout@v3 # with: # lfs: true # fetch-depth: 0 # - name: Setup Unreal Engine # run: | # # Ensure Unreal Engine is installed and set up # # This assumes you have Unreal Engine installed on your runner # # If not, you can add installation steps here # # Set environment variables for Unreal Engine # echo "UE_ROOT=C:\Program Files\Epic Games\UE_5.2" >> $GITHUB_ENV # - name: Build Unreal Project # run: | # # Find your .uproject file (adjust path as needed) # $UPROJECT_PATH = Get-ChildItem -Path . -Filter "*.uproject" -Recurse | Select-Object -First 1 -ExpandProperty FullName # Write-Host "Building project: $UPROJECT_PATH" # # Use Unreal Automation Tool to build the project # & "$env:UE_ROOT\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun ` # -project="$UPROJECT_PATH" ` # -noP4 ` # -platform=Win64 ` # -clientconfig=Development ` # -cook -build -stage -pak -archive ` # -archivedirectory="$PWD\Build" # - name: Upload build artifacts # uses: actions/upload-artifact@v3 # with: # name: windows-build # path: Build/ # retention-days: 7 macos-build: runs-on: macos steps: - name: Checkout repository uses: actions/checkout@v3 with: lfs: true fetch-depth: 0 - name: Setup Unreal Engine run: | # Use the correct path where Unreal Engine is installed UE_PATH="/Users/Shared/Epic Games/UE_5.5" if [ ! -d "$UE_PATH" ]; then echo "Error: Unreal Engine is not installed in the expected location" echo "Please ensure Unreal Engine is installed at $UE_PATH" exit 1 fi # Set environment variable with the correct Engine path echo "UE_ROOT=$UE_PATH/Engine" >> $GITHUB_ENV echo "Using Unreal Engine 5.5" # Set up MuJoCo library MUJOCO_LIB_DIR="Plugins/LuckyMujoco/Source/ThirdParty/Mujoco/lib" mkdir -p "$MUJOCO_LIB_DIR" # Try to find mujoco.dylib in the repository if [ -f "Plugins/UEMujoco.rar" ]; then echo "Found UEMujoco.rar, attempting to extract..." mkdir -p /tmp/mujoco_extract unrar x "Plugins/UEMujoco.rar" /tmp/mujoco_extract || echo "Failed to extract UEMujoco.rar" # Look for mujoco.dylib in extracted files DYLIB_PATH=$(find /tmp/mujoco_extract -name "mujoco.dylib" | head -1) if [ -n "$DYLIB_PATH" ]; then echo "Found mujoco.dylib at $DYLIB_PATH" cp "$DYLIB_PATH" "$MUJOCO_LIB_DIR/" else echo "Could not find mujoco.dylib in extracted files" fi fi # If still no dylib, try to download it if [ ! -f "$MUJOCO_LIB_DIR/mujoco.dylib" ]; then echo "Attempting to download mujoco.dylib..." curl -L -o "$MUJOCO_LIB_DIR/mujoco.dylib" "https://github.com/deepmind/mujoco/releases/download/2.3.7/mujoco-2.3.7-macos-universal2.dmg" fi # Verify the library exists if [ ! -f "$MUJOCO_LIB_DIR/mujoco.dylib" ]; then echo "ERROR: Failed to set up mujoco.dylib" exit 1 fi # Make sure the library is executable chmod +x "$MUJOCO_LIB_DIR/mujoco.dylib" # Create symbolic link in Engine/Source directory mkdir -p "$UE_PATH/Engine/Source" ln -sf "$(pwd)/$MUJOCO_LIB_DIR/mujoco.dylib" "$UE_PATH/Engine/Source/mujoco.dylib" # Set up library search paths export DYLD_LIBRARY_PATH="$(pwd)/$MUJOCO_LIB_DIR:$UE_PATH/Engine/Source:$DYLD_LIBRARY_PATH" echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" # List library files to verify echo "Library files in MuJoCo lib directory:" ls -la "$MUJOCO_LIB_DIR" echo "Library files in Engine/Source directory:" ls -la "$UE_PATH/Engine/Source" - name: Build Unreal Project run: | # Debug information echo "=== Environment Information ===" echo "macOS Version:" sw_vers echo "Current working directory: $(pwd)" ls -la # List all files in current directory echo "=== Unreal Engine Information ===" ls -la "$UE_ROOT/Build/BatchFiles" echo "=== Project Information ===" # Detailed search for the project file echo "Searching for .uproject files:" find . -name "*.uproject" -type f # Get the absolute path of the project file UPROJECT_PATH=$(find . -name "*.uproject" -type f | head -1) if [ -z "$UPROJECT_PATH" ]; then echo "Error: Could not find .uproject file" exit 1 fi # Convert to absolute path and verify file exists UPROJECT_ABSOLUTE_PATH=$(realpath "$UPROJECT_PATH") echo "Project absolute path: $UPROJECT_ABSOLUTE_PATH" if [ ! -f "$UPROJECT_ABSOLUTE_PATH" ]; then echo "Error: Project file does not exist at: $UPROJECT_ABSOLUTE_PATH" exit 1 fi echo "Using Unreal Engine at: $UE_ROOT" # Make the project file readable and executable chmod 755 "$UPROJECT_ABSOLUTE_PATH" # Run the build using absolute paths chmod +x "$UE_ROOT/Build/BatchFiles/RunUAT.sh" # Set up environment for the build export DYLD_LIBRARY_PATH="$(pwd)/Plugins/LuckyMujoco/Source/ThirdParty/Mujoco/lib:$UE_PATH/Engine/Source:$DYLD_LIBRARY_PATH" export DYLD_FRAMEWORK_PATH="$UE_PATH/Engine/Binaries/Mac:$DYLD_FRAMEWORK_PATH" export DYLD_FALLBACK_LIBRARY_PATH="$UE_PATH/Engine/Binaries/Mac:$DYLD_FALLBACK_LIBRARY_PATH" echo "Build environment:" echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" echo "DYLD_FRAMEWORK_PATH=$DYLD_FRAMEWORK_PATH" echo "DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH" # Verify library exists in expected locations echo "Checking for mujoco.dylib in various locations:" ls -l "$(pwd)/Plugins/LuckyMujoco/Source/ThirdParty/Mujoco/lib/mujoco.dylib" ls -l "$UE_PATH/Engine/Source/mujoco.dylib" "$UE_ROOT/Build/BatchFiles/RunUAT.sh" BuildCookRun \ -project="$UPROJECT_ABSOLUTE_PATH" \ -noP4 \ -platform=Mac \ -clientconfig=Development \ -cook -build -stage -pak -archive \ -archivedirectory="$(pwd)/Build" - name: Upload build artifacts uses: actions/upload-artifact@v3 with: name: macos-build path: Build/ retention-days: 7