Skip to content

Commit 8feb30e

Browse files
committed
ci: Add WebGL PlayMode test job (MTT-15569)
Split the WebGL CI into a build phase and a run phase. webgl-build.yml now exposes the built player as a dedicated 'players' artifact, and a new webgl-test.yml run job consumes it and executes the PlayMode tests inside Firefox on a GPU-backed Ubuntu agent (Unity::VM::GPU, rtx2080). The Firefox browser flags are passed explicitly so UTR does not attempt to download the browser from Stevedore. The run job is wired into the Nightly and Weekly (QV) triggers only, not into PR triggers, since WebGL failures are infrequent and the build is slow. Runtime RuntimePlatform.WebGLPlayer exclusions are intentionally deferred to be added reactively after the first real CI run.
1 parent 34e4784 commit 8feb30e

5 files changed

Lines changed: 103 additions & 20 deletions

File tree

.yamato/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CI related files are present inside .yamato/ folder and we can distinguish speci
2121
- `.yamato/project-standards.yml` responsible for running standards check on a package.
2222
- `.yamato/code-coverage.yml` responsible for running code coverage analysis.
2323
- `.yamato/performance-tests.yml` responsible for running performance tests.
24-
- `.yamato/webgl-build.yml` responsible for making a build for webgl platform.
24+
- `.yamato/webgl-test.yml` responsible for building a webgl player and running its PlayMode tests in a browser.
2525

2626
### Standalone Tests
2727
- `.yamato/desktop-standalone-tests.yml` responsible for running tests on standalone desktops.

.yamato/_run-all.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ run_all_webgl_builds:
129129
{% for project in projects.default -%}
130130
{% for platform in test_platforms.desktop -%}
131131
{% for editor in validation_editors.all -%}
132-
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}
132+
- .yamato/webgl-test.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}
133133
{% endfor -%}
134134
{% endfor -%}
135135
{% endfor -%}
@@ -141,7 +141,7 @@ run_all_webgl_builds_trunk:
141141
dependencies:
142142
{% for project in projects.default -%}
143143
{% for platform in test_platforms.desktop -%}
144-
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_trunk
144+
- .yamato/webgl-test.yml#webgl_build_{{ project.name }}_{{ platform.name }}_trunk
145145
{% endfor -%}
146146
{% endfor -%}
147147

@@ -152,7 +152,7 @@ run_all_webgl_builds_pinnedTrunk:
152152
dependencies:
153153
{% for project in projects.default -%}
154154
{% for platform in test_platforms.desktop -%}
155-
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ pinnedTrunk }}
155+
- .yamato/webgl-test.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ pinnedTrunk }}
156156
{% endfor -%}
157157
{% endfor -%}
158158

@@ -162,7 +162,41 @@ run_all_webgl_builds_6000:
162162
dependencies:
163163
{% for project in projects.default -%}
164164
{% for platform in test_platforms.desktop -%}
165-
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_6000.0
165+
- .yamato/webgl-test.yml#webgl_build_{{ project.name }}_{{ platform.name }}_6000.0
166+
{% endfor -%}
167+
{% endfor -%}
168+
169+
170+
# Runs all WebGL PlayMode tests (runs the produced player in a browser on a GPU agent)
171+
run_all_webgl_tests:
172+
name: Run All WebGl Tests
173+
dependencies:
174+
{% for project in projects.default -%}
175+
{% for platform in test_platforms.webgl_test -%}
176+
{% for editor in validation_editors.all -%}
177+
- .yamato/webgl-test.yml#webgl_test_{{ project.name }}_{{ platform.name }}_{{ editor }}
178+
{% endfor -%}
179+
{% endfor -%}
180+
{% endfor -%}
181+
182+
183+
# Runs all WebGL PlayMode tests on trunk editor
184+
run_all_webgl_tests_trunk:
185+
name: Run All WebGl Tests [Trunk only]
186+
dependencies:
187+
{% for project in projects.default -%}
188+
{% for platform in test_platforms.webgl_test -%}
189+
- .yamato/webgl-test.yml#webgl_test_{{ project.name }}_{{ platform.name }}_trunk
190+
{% endfor -%}
191+
{% endfor -%}
192+
193+
# Runs all WebGL PlayMode tests on 6000.0 editor
194+
run_all_webgl_tests_6000:
195+
name: Run All WebGl Tests [6000.0]
196+
dependencies:
197+
{% for project in projects.default -%}
198+
{% for platform in test_platforms.webgl_test -%}
199+
- .yamato/webgl-test.yml#webgl_test_{{ project.name }}_{{ platform.name }}_6000.0
166200
{% endfor -%}
167201
{% endfor -%}
168202

.yamato/_triggers.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ develop_nightly:
151151
# Build player for webgl platform on trunk and 6000.0 editors
152152
- .yamato/_run-all.yml#run_all_webgl_builds_trunk
153153
- .yamato/_run-all.yml#run_all_webgl_builds_6000
154+
# Run WebGL PlayMode tests (browser on GPU agent) on trunk and 6000.0 editors
155+
- .yamato/_run-all.yml#run_all_webgl_tests_trunk
156+
- .yamato/_run-all.yml#run_all_webgl_tests_6000
154157
# Run Runtime tests against cmb service on trunk and 6000.0 editors
155158
- .yamato/_run-all.yml#run_all_project_tests_cmb_service_trunk
156159
- .yamato/_run-all.yml#run_all_project_tests_cmb_service_6000
@@ -159,7 +162,7 @@ develop_nightly:
159162
- .yamato/project-updated-dependencies-test.yml#updated-dependencies_testproject_NGO_win_6000.0
160163
# Run API validation to early-detect all new APIs that would force us to release new minor version of the package. Note that for this to work the package version in package.json must correspond to "actual package state" which means that it should be higher than last released version
161164
- .yamato/vetting-test.yml#vetting_test
162-
# Run code coverage test (nightly uses actual trunk)
165+
# Run code coverage test (nightly uses actual trunk)
163166
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_trunk
164167

165168

@@ -189,5 +192,7 @@ develop_weekly_trunk:
189192
- .yamato/_run-all.yml#run_all_project_tests_console_standalone
190193
# Build player for webgl platform on trunk
191194
- .yamato/_run-all.yml#run_all_webgl_builds
195+
# Run WebGL PlayMode tests (browser on GPU agent)
196+
- .yamato/_run-all.yml#run_all_webgl_tests
192197
# Run Runtime tests against CMB service
193198
- .yamato/_run-all.yml#run_all_project_tests_cmb_service

.yamato/project.metafile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ test_platforms:
168168
flavor: b1.large
169169
larger_flavor: b1.xlarge
170170
standalone: GameCoreScarlett
171+
# WebGL runtime tests run the built player inside a browser, which requires a real GPU and display.
172+
# We therefore run them on a GPU-backed Ubuntu VM (rtx2080). Firefox is preinstalled on the package-ci Ubuntu image.
173+
webgl_test:
174+
- name: ubuntu
175+
type: Unity::VM::GPU
176+
image: package-ci/ubuntu-22.04:v4.87.0
177+
flavor: b1.large
178+
model: rtx2080
179+
standalone: WebGL
171180

172181
# EDITOR CONFIGURATIONS-------------------------------------------------------------------------------
173182
# Editors to be used for testing. NGOv2.X official support started from 6000.0 editor
Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,36 @@
22
---
33

44
# DESCRIPTION--------------------------------------------------------------------------
5-
# This job is responsible for validating a successful building of a player on WebGl standalone platform.
6-
# This job WILL NOT execute any tests, we only validate the building process.
7-
# This is because WebGL runs in browser and for tests to be executed we would need to consider having a web server, browser automation and overall complex test setup which currently we don't have.
5+
# This job is responsible for WebGL platform test validation.
6+
# It is split into a build phase (produces the WebGL player) and a run phase (executes the produced player inside a browser to run PlayMode tests).
87

98
# CONFIGURATION STRUCTURE--------------------------------------------------------------
10-
# Jobs configurations are generated using nested loops through:
11-
# 1. For the default project (project is used only as a context for the build).
12-
# 2. For all desktop platforms (Windows, Ubuntu, macOS)
13-
# 3. For all supported Unity Editor versions (For NGOv2.X it means 6000+)
9+
# Jobs are generated using nested loops (separate build phase and run phase). Worth noting that run phase uses the build as dependency:
10+
# 1. Build phase runs for all desktop platforms (Windows, Ubuntu, macOS); run phase runs on a single GPU-backed Ubuntu agent.
11+
# 2. For all supported Unity Editor versions (For NGOv2.X it means 6000+).
12+
# 3. For the default project.
1413

1514
# TECHNICAL CONSIDERATIONS----------------------------------------------------------------
16-
# WebGL requires IL2CPP scripting backend (Mono is not supported)
17-
# We are not using ARM64 architectures since we only perform a build action. x64 architectures are preferred for build phase (in order to optimize available resource usage)
18-
# We only perform build validation (no runtime testing)
15+
# WebGL requires IL2CPP scripting backend (Mono is not supported).
16+
# Build phase:
17+
# We are not using ARM64 architectures since we only perform a build action. x64 architectures are preferred for build phase (in order to optimize available resource usage).
18+
# Run phase:
19+
# Running the player means launching a real browser, which needs a GPU and a display, therefore we run on a GPU-backed Ubuntu agent (Unity::VM::GPU, rtx2080). See webgl_test in project.metafile.
20+
# We do NOT pass -nographics here (unlike the build job) because the browser needs graphics to run.
21+
# Firefox is preinstalled on the package-ci Ubuntu image (/usr/bin/firefox).
22+
# Passing --target-browser and --target-browser-executable explicitly is mandatory: without them UTR tries to download Firefox from Stevedore via perl, which fails on the CI agent.
23+
# --player-connection-ip=${BOKKEN_HOST_IP} is required so the browser-hosted player can connect back to the test runner.
1924

2025
# QUALITY CONSIDERATIONS--------------------------------------------------------------------
21-
# In the future we could try to implement an infrastructure to run test in webgl context but this could be quite complicated and would need to be evaluated if it's worth it
22-
# To see where this job is included (in trigger job definitions) look into _triggers.yml file
23-
# WebGL jobs were timing up more often in develop-2.0.0 branch (especially on trunk) so we increased the timeout from 1800 to 3600. We should investigate why it times more often in develop-2.0.0/ubuntu/trunk
26+
# WebGL failures are infrequent and the build is slow, so this job is placed on Nightly/Weekly (QV) only, not on PR triggers.
27+
# Runtime platform exclusions (RuntimePlatform.WebGLPlayer) are intentionally not pre-added; they are introduced reactively after the first real CI run.
28+
# To see where this job is included (in trigger job definitions) look into _triggers.yml file.
29+
# WebGL jobs were timing up more often in develop-2.0.0 branch (especially on trunk) so we increased the timeout from 1800 to 3600. We should investigate why it times more often in develop-2.0.0/ubuntu/trunk.
2430

2531
#--------------------------------------------------------------------------------------
2632

33+
34+
# BUILD PHASE CONFIGURATION------------------------------------------------------------------------------------
2735
{% for project in projects.default -%}
2836
{% for platform in test_platforms.desktop -%}
2937
{% for editor in validation_editors.all -%}
@@ -47,10 +55,37 @@ webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}:
4755
# This will perform only building phase (--build-only) with a timeout set by the test_timeout variable in the project metafile.
4856
- UnifiedTestRunner --suite=playmode --platform=WebGL --scripting-backend=il2cpp --testproject={{ project.path }} --editor-location=.Editor --artifacts_path=artifacts --player-save-path=build/players --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --reruncount=1 --clean-library-on-rerun --build-only --timeout={{ test_timeout }}
4957
artifacts:
58+
players:
59+
paths:
60+
- "build/players/**/*"
5061
logs:
5162
paths:
5263
- "artifacts/**/*"
53-
- "build/players/**/*"
64+
{% endfor -%}
65+
{% endfor -%}
66+
{% endfor -%}
67+
68+
69+
# RUN PHASE CONFIGURATION------------------------------------------------------------------------------------
70+
{% for project in projects.default -%}
71+
{% for platform in test_platforms.webgl_test -%}
72+
{% for editor in validation_editors.all -%}
73+
webgl_test_{{ project.name }}_{{ platform.name }}_{{ editor }}:
74+
name: WebGl Test - {{ project.name }} [{{ platform.name }}, {{ editor }}, il2cpp]
75+
agent:
76+
type: {{ platform.type }}
77+
image: {{ platform.image }}
78+
flavor: {{ platform.flavor }}
79+
model: {{ platform.model }} # GPU model required to run a browser (more information in project.metafile)
80+
commands:
81+
- unity-downloader-cli --fast --wait -u {{ editor }} -c Editor -c webgl -c il2cpp # Downloading the editor with additional webgl and il2cpp components
82+
- UnifiedTestRunner --suite=playmode --platform=WebGL --scripting-backend=il2cpp --testproject={{ project.path }} --editor-location=.Editor --artifacts_path=artifacts --player-load-path=build/players --target-browser=Firefox --target-browser-executable=/usr/bin/firefox --player-connection-ip=${BOKKEN_HOST_IP} --reruncount=1 --clean-library-on-rerun --timeout={{ test_timeout }}
83+
artifacts:
84+
logs:
85+
paths:
86+
- "artifacts/**/*"
87+
dependencies:
88+
- .yamato/webgl-test.yml#webgl_build_{{ project.name }}_ubuntu_{{ editor }}
5489
{% endfor -%}
5590
{% endfor -%}
5691
{% endfor -%}

0 commit comments

Comments
 (0)