浏览代码

Add tests to make sure il2cpp works with fast training.

/develop/update-grpc
Christopher Goy 4 年前
当前提交
69481f99
共有 6 个文件被更改,包括 40 次插入12 次删除
  1. 18
      .yamato/standalone-build-test.yml
  2. 3
      .yamato/test_versions.metafile
  3. 8
      .yamato/training-int-tests.yml
  4. 17
      Project/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs
  5. 3
      ml-agents/tests/yamato/standalone_build_tests.py
  6. 3
      ml-agents/tests/yamato/yamato_utils.py

18
.yamato/standalone-build-test.yml


{% metadata_file .yamato/test_versions.metafile %}
---
{% for editor in test_editors %}
test_linux_standalone_{{ editor.version }}:
name: Test Linux Standalone {{ editor.version }}
{% for backend in scripting_backends %}
test_linux_standalone_{{ editor.version }}_{{ backend.backend }}:
name: Test Linux Standalone {{ editor.version }} {{ backend.backend }}
agent:
type: Unity::VM
image: package-ci/ubuntu:v1.3.1-719011

- python3 -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
- python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
- unity-downloader-cli -u {{ editor.version }} -c editor --wait --fast
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/Basic/Scenes/Basic.unity
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/Match3/Scenes/Match3.unity
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/TestScenes/TestCompressedGrid/TestGridCompressed.unity
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/TestScenes/TestCompressedTexture/TestTextureCompressed.unity
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --mlagents-scripting-backend={{ backend.backend }}
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/Basic/Scenes/Basic.unity --mlagents-scripting-backend={{ backend.backend }}
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/Match3/Scenes/Match3.unity --mlagents-scripting-backend={{ backend.backend }}
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity --mlagents-scripting-backend={{ backend.backend }}
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/TestScenes/TestCompressedGrid/TestGridCompressed.unity --mlagents-scripting-backend={{ backend.backend }}
- python3 -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=linux --scene=Assets/ML-Agents/TestScenes/TestCompressedTexture/TestTextureCompressed.unity --mlagents-scripting-backend={{ backend.backend }}
triggers:
cancel_old_ci: true
expression: |

- "artifacts/testPlayer*/**"
- "artifacts/**/UnityPlayer.so"
{% endfor %}
{% endfor %}

3
.yamato/test_versions.metafile


extra_test: sensor
- version: 2021.1
extra_test: llapi
scripting_backends:
- backend: mono
- backend: il2cpp

8
.yamato/training-int-tests.yml


{% metadata_file .yamato/test_versions.metafile %}
---
{% for editor in test_editors %}
test_linux_training_int_{{ editor.version }}:
name: Test Linux Fast Training {{ editor.version }}
{% for backend in scripting_backends %}
test_linux_training_int_{{ editor.version }}_{{ backend.backend }}:
name: Test Linux Fast Training {{ editor.version }} {{ backend.backend }}
agent:
type: Unity::VM
image: package-ci/ubuntu:v1.3.1-719011

python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
python -u -m ml-agents.tests.yamato.training_int_tests
dependencies:
- .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}
- .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}_{{ backend.backend }}
triggers:
cancel_old_ci: true
expression: |

- "artifacts/testPlayer*/**"
- "artifacts/models/**"
{% endfor %}
{% endfor % }

17
Project/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs


{
const string k_OutputCommandLineFlag = "--mlagents-build-output-path";
const string k_SceneCommandLineFlag = "--mlagents-build-scene-path";
private const string k_BuildTargetFlag = "--mlagents-build-target";
const string k_BuildTargetFlag = "--mlagents-build-target";
const string k_ScriptingBackendFlag = "--mlagents-scripting-backend";
public static void BuildStandalonePlayerOSX()
{

var buildTarget = BuildTarget.StandaloneOSX;
var scriptingBackend = ScriptingImplementation.Mono2x;
var args = Environment.GetCommandLineArgs();
for (var i = 0; i < args.Length - 1; i++)

{
buildTarget = (BuildTarget)Enum.Parse(typeof(BuildTarget), args[i + 1], ignoreCase: true);
}
else if (args[i] == k_ScriptingBackendFlag)
{
var val = args[i + 1];
if (val == "mono")
{
scriptingBackend = ScriptingImplementation.Mono2x;
}
else
{
scriptingBackend = ScriptingImplementation.IL2CPP;
}
}
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Standalone, scriptingBackend);
var buildResult = BuildPipeline.BuildPlayer(
scenes,
outputPath,

3
ml-agents/tests/yamato/standalone_build_tests.py


parser.add_argument(
"--build-target", default="mac", choices=["mac", "linux", "ios", "webgl"]
)
parser.add_argument(
"--scripting-backen", default="mono", choices=["mono", "il2cpp"]
)
args = parser.parse_args()
main(args.scene, args.build_target)

3
ml-agents/tests/yamato/yamato_utils.py


output_path: str = None,
scene_path: str = None,
build_target: str = None,
scripting_backend: str = "mono",
log_output_path: Optional[str] = f"{get_base_output_path()}/standalone_build.txt",
) -> int:
"""

test_args += ["--mlagents-build-scene-path", scene_path]
if build_target_enum is not None:
test_args += ["--mlagents-build-target", build_target_enum]
if scripting_backend != "mono":
test_args += ["--mlagents-scripting-backend", scripting_backend]
print(f"{' '.join(test_args)} ...")
timeout = 30 * 60 # 30 minutes, just in case

正在加载...
取消
保存