Skip to content

Commit 8bfcb71

Browse files
committed
Added comments and modifications to webgl job
1 parent 030fc67 commit 8bfcb71

File tree

1 file changed

+46
-29
lines changed

1 file changed

+46
-29
lines changed

.yamato/webgl-build.yml

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
1-
{% metadata_file .yamato/project.metafile %}
1+
{% metadata_file .yamato/project.metafile %} # All configuration that is used to create different configurations (used in for loops) is taken from this file.
22
---
33

4-
# Builds a player on WebGl standalone platform without executing any tests.
5-
# This setup performs build-only validation since WebGL runs in browser and for tests to be executed we would need to
6-
# consider having a web server, browser automation and overall complex test setup.
7-
# Default project (testptoject) in this case is used as a context.
8-
# WebGL requires Il2cpp scripting backend so mono is not considered
9-
# ARM64 architectures are not considered since Windows_arm64 is recommended to use only after builds and when it comes to macOS_arm64 there is problem with OpenCL not being available
10-
# Builds are made on each desktop platform as in project.metafile declaration
11-
{% for project in projects.default -%}
12-
{% for platform in test_platforms.desktop -%}
13-
{% for editor in validation_editors.all -%}
14-
webgl_build_{{ project.name }}_{{ platform }}_{{ editor }}:
15-
name: WebGl Build - {{ project.name }} [{{ platform.name }}, {{ editor }}, il2cpp]
16-
agent:
17-
type: {% if platform.name == "mac" %} {{ platform.type }} {% else %} {{ platform.type }}::GPU {% endif %}
18-
image: {{ platform.image }}
19-
flavor: {{ platform.flavor }}
20-
commands:
21-
# Installing tools
22-
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
4+
# DESCRIPTION--------------------------------------------------------------------------
5+
# This job definition creates job configurations to test building a player on WebGl standalone platform.
6+
# This job will not execute any tests, we only test building process.
7+
# This setup performs build-only validation (without running tests) 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.
238

24-
# Installing editor
25-
- unity-downloader-cli -u {{ editor }} -c Editor -c webgl -c il2cpp -w --fast
9+
# The setup below defines multiple jobs with different configurations (taken from project.metafile in the 1st line).
10+
# This is a Yamato specific as it will "compile" this script and generate given configurations which we can easily modify from within project.metafile.
11+
# From there (project.metafile) we could easily add for example a new validation editor or remove unsupported one.
2612

27-
# Build Player
28-
- 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="-cloudEnvironment staging" --extra-editor-arg=-nographics --reruncount=1 --clean-library-on-rerun --build-only --timeout=1800
13+
# CONFIGURATION STRUCTURE--------------------------------------------------------------
14+
# Jobs are generated using nested loops through:
15+
# 1. Projects (from project.metafile)
16+
# 2. Desktop platforms (Windows, Ubuntu, macOS)
17+
# 3. Supported Unity Editor versions
18+
# This structure allows easy modification of supported configurations via project.metafile
19+
20+
# TECHNICAL CONSTRAINTS----------------------------------------------------------------
21+
# WebGL requires IL2CPP scripting backend (Mono not supported)
22+
# x64 architectures preferred for build phase (ARM64 not used to optimize resource usage. For build phase x64 architectures are preferred)
23+
# Build validation only (no runtime testing)
24+
2925

26+
#--------------------------------------------------------------------------------------
27+
28+
{% for project in projects.default -%} # Default project (testptoject) in this case is used as a context for the build.
29+
{% for platform in test_platforms.desktop -%} # Jobs are being defined per each desktop platform as in project.metafile declaration (Win, Ubuntu, Mac)
30+
{% for editor in validation_editors.all -%} # Jobs are being defined per each supported editor (For NGOv2.X it means 6000+)
31+
webgl_build_{{ project.name }}_{{ platform }}_{{ editor }}: # This is a job name when querying from code (for example in _run-all.yml). Notice that parts of it will be filled in from for loops. For example there will be a configuration "webgl_build_testproject_win_6000.0" and when querying for this job we could for example change some values to get a given job (for example change editor value) and this will query different job configuration
32+
name: WebGl Build - {{ project.name }} [{{ platform.name }}, {{ editor }}, il2cpp] # This is a job name visible in Yamato (notice that here we also use "generated" fields from for loops
33+
agent:
34+
type: {{ platform.type }} # Defines type from platform configuration (for example Unity::VM). For webgl builds no GPU extension is needed
35+
image: {{ platform.image }} # Bokken image specification
36+
flavor: {{ platform.flavor }} # Memory/CPU allocation configuration
37+
commands:
38+
- unity-downloader-cli -u {{ editor }} -c Editor -c webgl -c il2cpp # unity-downloader-cli should be already preinstalled on the image. This steps downloads proper editor to build from together with required components (webgl + il2cpp).
39+
40+
# The following step builds the player with defined options such as:
41+
# Suite parameter if defined since it's a mandatory field to define which test suite should be used, but it doesn't matter in this case since we won't run any tests (--suite)
42+
# We specify build platform (--platform), scripting backend (--scripting-backend) and preinstalled editor location (--editor-location)
43+
# We will be building project defined in (--testproject)
44+
# Custom artifact paths for logs and build output (via --artifacts_path and --player-save-path)
45+
# Editor is run in batchmode, which means that Unity runs command line arguments without the need for human interaction. It also suppresses pop-up windows that require human interaction (such as the Save Scene window). We should always run Unity in batch mode when using command line arguments, because it allows automation to run without interruption. (--extra-editor-arg=-batchmode)
46+
# Engine is initialized in ‘nographics’ mode since we don't need any graphics for this case (--extra-editor-arg=-nographics)
47+
# In case of failure the job will be rerunned once (--reruncount=1) with clean library (--clean-library-on-rerun)
48+
# This will perform only building phase (--build-only) with a default timeout of 3m (--timeout=1800)
49+
- 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=1800
3050
artifacts:
3151
logs:
3252
paths:
33-
- "artifacts/**/*"
34-
- "build/players/**/*"
35-
variables:
36-
CI: true
37-
ENABLE_BURST_COMPILATION: False
53+
- "artifacts/**/*" # Build process logs (path defined via --artifacts_path argument)
54+
- "build/players/**/*" # WebGL build output files (path defined via --player-save-path argument)
3855
{% endfor -%}
3956
{% endfor -%}
4057
{% endfor -%}

0 commit comments

Comments
 (0)