浏览代码

Add a standalone build test pipeline to Yamato to check for player script compilation errors. (#2779)

/develop-gpu-test
GitHub 5 年前
当前提交
bcf5b967
共有 4 个文件被更改,包括 100 次插入0 次删除
  1. 24
      .yamato/standalone-build-test.yml
  2. 27
      UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs
  3. 11
      UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs.meta
  4. 38
      run-standalone-build-osx.sh

24
.yamato/standalone-build-test.yml


name: Mac Standalone Build Test
triggers:
branches:
only:
- "/develop-.*/"
targets:
only:
- "develop"
pull_requests:
- targets:
only:
- "master"
- "/release-.*/"
- "/hotfix-.*/"
agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:latest
flavor: i1.small
variables:
LC_ALL: "en_US.UTF-8"
commands:
- ./run-standalone-build-osx.sh

27
UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs


using System;
using UnityEditor;
using UnityEngine;
namespace MLAgents
{
public class StandaloneBuildTest
{
static void BuildStandalonePlayerOSX()
{
string[] scenes = { "Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity" };
var error = BuildPipeline.BuildPlayer(scenes, "testPlayer", BuildTarget.StandaloneOSX, BuildOptions.None);
if (string.IsNullOrEmpty(error))
{
EditorApplication.Exit(0);
}
else
{
Console.Error.WriteLine(error);
EditorApplication.Exit(1);
}
Debug.Log(error);
}
}
}

11
UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs.meta


fileFormatVersion: 2
guid: a0c87e095448c49e9812863bb5d1f4e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

38
run-standalone-build-osx.sh


#!/bin/bash
set -eo pipefail
EDITOR_VERSION="2017.4.33f1"
BOKKEN_UNITY="/Users/bokken/${EDITOR_VERSION}/Unity.app/Contents/MacOS/Unity"
HUB_UNITY="/Applications/Unity/Hub/Editor/${EDITOR_VERSION}/Unity.app/Contents/MacOS/Unity"
if [[ -f ${BOKKEN_UNITY} ]]; then
UNITY=${BOKKEN_UNITY}
else
UNITY=${HUB_UNITY}
fi
pushd $(dirname "${0}") > /dev/null
BASETPATH=$(pwd -L)
popd > /dev/null
echo "Cleaning previous results"
echo "Starting tests via $UNITY"
CMD_LINE="$UNITY -projectPath $BASETPATH/UnitySDK -batchmode -executeMethod MLAgents.StandaloneBuildTest.BuildStandalonePlayerOSX"
echo "$CMD_LINE ..."
${CMD_LINE}
RES=$?
if [[ "${RES}" -eq "0" ]]; then
echo "Standalone build completed successfully.";
exit 0;
else
echo "Standalone build failed."
exit 1;
fi
exit ${RES}
正在加载...
取消
保存