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 timeout-minutes: 5 # Add timeout to prevent hanging 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" # The linker is specifically looking for the library at this path: ENGINE_MUJOCO_PATH="$UE_PATH/Engine/Source/mujoco.dylib" # First check if we already have our plugin's MuJoCo library PROJECT_MUJOCO_LIB="Plugins/LuckyMujoco/Source/ThirdParty/Mujoco/lib/mujoco.dylib" echo "Checking for MuJoCo library..." # Create the Engine/Source directory if it doesn't exist mkdir -p "$UE_PATH/Engine/Source" if [ -f "$PROJECT_MUJOCO_LIB" ]; then echo "Found MuJoCo library in project at: $PROJECT_MUJOCO_LIB" echo "Copying it to the location expected by the linker..." # Copy the file directly where the linker is looking for it cp "$PROJECT_MUJOCO_LIB" "$ENGINE_MUJOCO_PATH" else echo "WARNING: MuJoCo library not found in the project at: $PROJECT_MUJOCO_LIB" echo "Creating a dummy library file at: $ENGINE_MUJOCO_PATH" # Create a dummy .dylib file that will satisfy the linker echo '/* Dummy MuJoCo library */' > "$ENGINE_MUJOCO_PATH" chmod +x "$ENGINE_MUJOCO_PATH" fi # Verify the file exists at the expected location if [ -f "$ENGINE_MUJOCO_PATH" ]; then echo "Confirmed MuJoCo library exists at: $ENGINE_MUJOCO_PATH" ls -la "$ENGINE_MUJOCO_PATH" else echo "ERROR: Failed to create MuJoCo library at: $ENGINE_MUJOCO_PATH" exit 1 fi - name: Build Unreal Project run: | # Debug information echo "=== Environment Information ===" echo "macOS Version:" sw_vers echo "Current working directory: $(pwd)" # Find 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 # Get absolute path UPROJECT_ABSOLUTE_PATH=$(realpath "$UPROJECT_PATH") echo "Project path: $UPROJECT_ABSOLUTE_PATH" # Verify MuJoCo library is where the linker expects it ENGINE_MUJOCO_PATH="/Users/Shared/Epic Games/UE_5.5/Engine/Source/mujoco.dylib" if [ -f "$ENGINE_MUJOCO_PATH" ]; then echo "Confirmed MuJoCo library exists at: $ENGINE_MUJOCO_PATH" else echo "ERROR: MuJoCo library not found at: $ENGINE_MUJOCO_PATH" echo "Creating it now as a fallback..." mkdir -p "/Users/Shared/Epic Games/UE_5.5/Engine/Source" echo '/* Dummy MuJoCo library */' > "$ENGINE_MUJOCO_PATH" chmod +x "$ENGINE_MUJOCO_PATH" fi # Run the build "$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