首页 > 解决方案 > 在 GitHub 上集成 Travis CI 和 Unity 的问题

问题描述

我按照此链接中的说明将 Travis CI 集成到 Unity

不幸的是,构建似乎失败了,接下来你可以找到我为这个集成添加到 GitHub 的任何内容。PS:我是CI的新手。

travis.yml 文件

language: objective-c
osx_image: xcode9.2
rvm:
- 2.2         #see before_install for getting RVM stable.

env:
- TRAVIS_TAG="Deploy-2019.3.4f1" PROJECT_NAME="DungeonToolGeneration" UNITY_PROJECT_PATH="" DEPLOY_UNITYPACKAGE="path set in deploy script"


cache:
  directories:
    - $UNITY_DOWNLOAD_CACHE

    
before_install:
- chmod a+x ./travis-build/*.sh

install:
- cat /etc/hosts
- ./travis-build/install-unity.sh

script:
- ./travis-build/build.sh
- ./travis-build/run-tests.sh

after_success:
- ./travis-build/export-unity-package.sh

before_deploy:
- DEPLOY_UNITYPACKAGE="$(ls -a release/*.zip | head -n 1)"

deploy:
  provider: releases
  api_key: $GITHUB_TOKEN
  file: $DEPLOY_UNITYPACKAGE
  skip_cleanup: true
  overwrite: true
  on:
    tags: true 

我编辑的 install_unity 文件将版本更改为与项目相同


#! /bin/sh

# See https://unity3d.com/get-unity/download/archive
# to get download URLs
UNITY_DOWNLOAD_CACHE="$(pwd)/unity_download_cache"
UNITY_OSX_PACKAGE_URL="https://download.unity3d.com/download_unity/4f139db2fdbd/MacEditorInstaller/Unity.pkg"
UNITY_WINDOWS_TARGET_PACKAGE_URL="https://download.unity3d.com/download_unity/4f139db2fdbd/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-2019.3.4f1.pkg"


# Downloads a file if it does not exist
download() {

    URL=$1
    FILE=`basename "$URL"`
    
    # Downloads a package if it does not already exist in cache
    if [ ! -e $UNITY_DOWNLOAD_CACHE/`basename "$URL"` ] ; then
        echo "$FILE does not exist. Downloading from $URL: "
        mkdir -p "$UNITY_DOWNLOAD_CACHE"
        curl -o $UNITY_DOWNLOAD_CACHE/`basename "$URL"` "$URL"
    else
        echo "$FILE Exists. Skipping download."
    fi
}

# Downloads and installs a package from an internet URL
install() {
    PACKAGE_URL=$1
    download $1

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



echo "Contents of Unity Download Cache:"
ls $UNITY_DOWNLOAD_CACHE

echo "Installing Unity..."
install $UNITY_OSX_PACKAGE_URL
install $UNITY_WINDOWS_TARGET_PACKAGE_URL

特拉维斯日志

TLDR 日志

    Items in project path (/Users/travis/build/ZarakiKanzaki/DungeonToolGeneration/):

Assets          ProjectSettings     travis-build

Packages        README.md       unity_download_cache

Building project for Windows...

[LicensingClient] ERROR Failed to connect to local IPC

[Licensing::Module] Failed to connect to channel: LicenseClient-travis

Launching external process: /Applications/Unity/Unity.app/Contents/Frameworks/UnityLicensingClient.app/Contents/Resources/Unity.Licensing.Client

[Licensing::Module] Successfully launched the LicensingClient

[Licensing::Module] Successfully connected to LicensingClient on channel: LicenseClient-travis

[Licensing::Module] Successfully launched and connected to LicensingClient

Entitlement-based licensing initiated

[LicensingClient] Licenses Updated successfully in LicensingClient

DisplayProgressbar: Unity license

[UnityConnectServicesConfig] config is NOT valid, switching to default

[Licensing::Module] License is not active (com.unity.editor.headless). HasEntitlements will fail.

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

Cancelling DisplayDialog: Failed to activate/update license Missing or bad username or password. Please try again using valid credentials or contact support@unity3d.com

This should not be called in batch mode. 

(Filename: /Users/builduser/buildslave/unity/build/Editor/Platform/OSX/EditorUtility.mm Line: 288)

Building Windows exe completed successfully.

Finishing with code 0

The command "./travis-build/build.sh" exited with 0.

0.05s$ ./travis-build/run-tests.sh

Skipping testing. No Tests implemented yet...

The command "./travis-build/run-tests.sh" exited with 0.

标签: gitunity3dgithubtravis-ci

解决方案


我做了一些研究,这似乎是一个凭证问题,我目前正在调查是否可以使用普通许可证进行部署。

目前我的管道上的部署已暂停。


推荐阅读