From ee52af22dc668bb7e435ec4f31c80b83359e62b9 Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Wed, 17 Feb 2021 20:31:59 -0800 Subject: [PATCH 1/2] WebGL compile test --- .yamato/standalone-build-webgl-test.yml | 30 +++++++++++++++++++ .../tests/yamato/standalone_build_tests.py | 4 ++- ml-agents/tests/yamato/yamato_utils.py | 11 ++++--- 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 .yamato/standalone-build-webgl-test.yml diff --git a/.yamato/standalone-build-webgl-test.yml b/.yamato/standalone-build-webgl-test.yml new file mode 100644 index 0000000000..bbf802f292 --- /dev/null +++ b/.yamato/standalone-build-webgl-test.yml @@ -0,0 +1,30 @@ +{% capture editor_version %}2020.2{% endcapture %} +test_webgl_standalone_{{ editor_version }}: + name: Test WebGL Standalone {{ editor_version }} + agent: + type: Unity::VM + image: package-ci/ubuntu:stable + flavor: b1.large + variables: + UNITY_VERSION: {{ editor.version }} + commands: + - | + python3 -m venv venv && source venv/bin/activate + python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple + python -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 -c WebGL --wait --fast + python -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=webgl + + triggers: + cancel_old_ci: true + recurring: + - branch: master + frequency: weekly + artifacts: + logs: + paths: + - "artifacts/standalone_build.txt" + standalonebuild: + paths: + - "artifacts/testPlayer*/**" + - "artifacts/**/UnityPlayer.so" diff --git a/ml-agents/tests/yamato/standalone_build_tests.py b/ml-agents/tests/yamato/standalone_build_tests.py index 57902c51f3..436e1e5aa1 100644 --- a/ml-agents/tests/yamato/standalone_build_tests.py +++ b/ml-agents/tests/yamato/standalone_build_tests.py @@ -35,6 +35,8 @@ def main(scene_path, build_target): if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--scene", default=None) - parser.add_argument("--build-target", default="mac", choices=["mac", "linux"]) + parser.add_argument( + "--build-target", default="mac", choices=["mac", "linux", "ios", "webgl"] + ) args = parser.parse_args() main(args.scene, args.build_target) diff --git a/ml-agents/tests/yamato/yamato_utils.py b/ml-agents/tests/yamato/yamato_utils.py index aeffefab3d..2302227db1 100644 --- a/ml-agents/tests/yamato/yamato_utils.py +++ b/ml-agents/tests/yamato/yamato_utils.py @@ -3,7 +3,7 @@ import subprocess import yaml from sys import platform -from typing import List, Optional +from typing import List, Optional, Mapping def get_unity_executable_path(): @@ -46,11 +46,14 @@ def run_standalone_build( print(f"Running BuildStandalonePlayer via {unity_exe}") # enum values from https://docs.unity3d.com/2019.4/Documentation/ScriptReference/BuildTarget.html - build_target_to_enum = { + build_target_to_enum: Mapping[Optional[str], str] = { "mac": "StandaloneOSX", "osx": "StandaloneOSX", "linux": "StandaloneLinux64", } + # Convert the short name to the official enum + # Just pass through if it's not on the list. + build_target_enum = build_target_to_enum.get(build_target, build_target) test_args = [ unity_exe, @@ -75,8 +78,8 @@ def run_standalone_build( os.makedirs(os.path.dirname(output_path), exist_ok=True) if scene_path is not None: test_args += ["--mlagents-build-scene-path", scene_path] - if build_target is not None: - test_args += ["--mlagents-build-target", build_target_to_enum[build_target]] + if build_target_enum is not None: + test_args += ["--mlagents-build-target", build_target_enum] print(f"{' '.join(test_args)} ...") timeout = 30 * 60 # 30 minutes, just in case From d9a04c7d460dbf3cdf19670c73d0efc021092dab Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Wed, 17 Feb 2021 20:34:08 -0800 Subject: [PATCH 2/2] fix template --- .yamato/standalone-build-webgl-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.yamato/standalone-build-webgl-test.yml b/.yamato/standalone-build-webgl-test.yml index bbf802f292..f4193f8273 100644 --- a/.yamato/standalone-build-webgl-test.yml +++ b/.yamato/standalone-build-webgl-test.yml @@ -6,7 +6,7 @@ test_webgl_standalone_{{ editor_version }}: image: package-ci/ubuntu:stable flavor: b1.large variables: - UNITY_VERSION: {{ editor.version }} + UNITY_VERSION: {{ editor_version }} commands: - | python3 -m venv venv && source venv/bin/activate