对未在Travis CI中构建的Unity进行故障排除

时间:2017-11-08 10:55:52

标签: git unity3d github continuous-integration travis-ci

我已经使用我的GitHub仓库设置了Travis CI,它拥有我的Unity项目,它目前自动尝试构建我的项目,但到目前为止还没有成功过一次。经过大量的研究和故障排除后,它现在已经达到了Travis成功下载和安装所需文件(Yay!Progress)的程度,但它在构建中陷入困境。 这是输出

Attempting to build GodGame for Windows

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

The build has been terminated

我的.travis.yml有

language: objective-c
osx_image: xcode8.1
rvm:
- 2.2
before_install:
- chmod a+x ./Script/install.sh
- chmod a+x ./Script/build.sh
install:
- ./Script/install.sh
script:
- ./Script/build.sh

我的install.sh有

#!/bin/sh

BASE_URL=http://netstorage.unity3d.com/unity
HASH=46dda1414e51
VERSION=2017.2.0f3

download() {
  file=$1
  url="$BASE_URL/$HASH/$package"

  echo "Downloading from $url: "
  curl -o `basename "$package"` "$url"
}

install() {
  package=$1
  download "$package"

  echo "Installing "`basename "$package"`
  sudo installer -dumplog -package `basename "$package"` -target /
}

# See $BASE_URL/$HASH/unity-$VERSION-$PLATFORM.ini for complete list
# of available packages, where PLATFORM is `osx` or `win`

install "MacEditorInstaller/Unity-$VERSION.pkg"
install "MacEditorTargetInstaller/UnitySetup-Windows-Support-for-Editor-$VERSION.pkg"
install "MacEditorTargetInstaller/UnitySetup-Mac-Support-for-Editor-$VERSION.pkg"
install "MacEditorTargetInstaller/UnitySetup-Linux-Support-for-Editor-$VERSION.pkg"

我的build.sh有

#!/bin/sh

project="GodGame"

echo "Attempting to build $project for Windows"
/Applications/Unity/Unity.app/Contents/MacOS/Unity 
  -batchmode 
  -nographics 
  -silent-crashes 
  -logFile $(pwd)/unity.log 
  -projectPath $(pwd) 
  -buildWindowsPlayer "$(pwd)/Build/windows/$project.exe" 
  -quit

echo "Attempting to build $project for OS X"
/Applications/Unity/Unity.app/Contents/MacOS/Unity 
  -batchmode 
  -nographics 
  -silent-crashes 
  -logFile $(pwd)/unity.log 
  -projectPath $(pwd) 
  -buildOSXUniversalPlayer "$(pwd)/Build/osx/$project.app" 
  -quit

echo "Attempting to build $project for Linux"
/Applications/Unity/Unity.app/Contents/MacOS/Unity 
  -batchmode 
  -nographics 
  -silent-crashes 
  -logFile $(pwd)/unity.log 
  -projectPath $(pwd) 
  -buildLinuxUniversalPlayer "$(pwd)/Build/linux/$project.exe" 
  -quit

echo 'Logs from build'
cat $(pwd)/unity.log


echo 'Attempting to zip builds'
zip -r $(pwd)/Build/linux.zip $(pwd)/Build/linux/
zip -r $(pwd)/Build/mac.zip $(pwd)/Build/osx/
zip -r $(pwd)/Build/windows.zip $(pwd)/Build/windows/

如果有帮助,这是我的.gitignore。在这里我可能需要删除一行吗?

###
# Unity folders and files
###
[Aa]ssets/AssetStoreTools*
[Bb]uild/
[Ll]ibrary/
[Ll]ocal[Cc]ache/
[Oo]bj/
[Tt]emp/
[Uu]nityGenerated/
# file on crash reports
sysinfo.txt
# Unity3D generated meta files
*.pidb.meta

###
# VS/MD solution and project files
###
[Ee]xportedObj/
*.booproj
*.csproj
*.sln
*.suo
*.svd
*.unityproj
*.user
*.userprefs
*.pidb
.DS_Store

###
# OS generated
###
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

请注意,当我直接从Unity尝试时,它确实在我的本地计算机上构建。 提前感谢任何可以提供帮助的人。请记住,我之前从未使用过CI,所以这也是我想要学习的。我也对其他CI解决方案的任何建议持开放态度。一些免费的东西,最好不需要我的项目是开源的(私人仓库),并且(最好)基于云的。

1 个答案:

答案 0 :(得分:0)

您的构建命令中缺少\。将它添加到单独的行中,因为现在它没有获得标志。例如:

echo "Attempting to build $project for OS X"
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
  -batchmode \
  -nographics \
  -silent-crashes \
  -logFile $(pwd)/unity.log \
  -projectPath $(pwd) \
  -buildOSXUniversalPlayer "$(pwd)/Build/osx/$project.app" \
  -quit