Skip to content

Commit a56e96c

Browse files
author
Chris Elion
authored
WebGL compile test (#4966)
1 parent 6444e0e commit a56e96c

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% capture editor_version %}2020.2{% endcapture %}
2+
test_webgl_standalone_{{ editor_version }}:
3+
name: Test WebGL Standalone {{ editor_version }}
4+
agent:
5+
type: Unity::VM
6+
image: package-ci/ubuntu:stable
7+
flavor: b1.large
8+
variables:
9+
UNITY_VERSION: {{ editor_version }}
10+
commands:
11+
- |
12+
python3 -m venv venv && source venv/bin/activate
13+
python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
14+
python -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
15+
unity-downloader-cli -u {{ editor_version }} -c editor -c WebGL --wait --fast
16+
python -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=webgl
17+
18+
triggers:
19+
cancel_old_ci: true
20+
recurring:
21+
- branch: master
22+
frequency: weekly
23+
artifacts:
24+
logs:
25+
paths:
26+
- "artifacts/standalone_build.txt"
27+
standalonebuild:
28+
paths:
29+
- "artifacts/testPlayer*/**"
30+
- "artifacts/**/UnityPlayer.so"

ml-agents/tests/yamato/standalone_build_tests.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def main(scene_path, build_target):
3535
if __name__ == "__main__":
3636
parser = argparse.ArgumentParser()
3737
parser.add_argument("--scene", default=None)
38-
parser.add_argument("--build-target", default="mac", choices=["mac", "linux"])
38+
parser.add_argument(
39+
"--build-target", default="mac", choices=["mac", "linux", "ios", "webgl"]
40+
)
3941
args = parser.parse_args()
4042
main(args.scene, args.build_target)

ml-agents/tests/yamato/yamato_utils.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44
import yaml
55
from sys import platform
6-
from typing import List, Optional
6+
from typing import List, Optional, Mapping
77

88

99
def get_unity_executable_path():
@@ -46,11 +46,14 @@ def run_standalone_build(
4646
print(f"Running BuildStandalonePlayer via {unity_exe}")
4747

4848
# enum values from https://docs.unity3d.com/2019.4/Documentation/ScriptReference/BuildTarget.html
49-
build_target_to_enum = {
49+
build_target_to_enum: Mapping[Optional[str], str] = {
5050
"mac": "StandaloneOSX",
5151
"osx": "StandaloneOSX",
5252
"linux": "StandaloneLinux64",
5353
}
54+
# Convert the short name to the official enum
55+
# Just pass through if it's not on the list.
56+
build_target_enum = build_target_to_enum.get(build_target, build_target)
5457

5558
test_args = [
5659
unity_exe,
@@ -75,8 +78,8 @@ def run_standalone_build(
7578
os.makedirs(os.path.dirname(output_path), exist_ok=True)
7679
if scene_path is not None:
7780
test_args += ["--mlagents-build-scene-path", scene_path]
78-
if build_target is not None:
79-
test_args += ["--mlagents-build-target", build_target_to_enum[build_target]]
81+
if build_target_enum is not None:
82+
test_args += ["--mlagents-build-target", build_target_enum]
8083
print(f"{' '.join(test_args)} ...")
8184

8285
timeout = 30 * 60 # 30 minutes, just in case

0 commit comments

Comments
 (0)