Skip to content

Commit d79c743

Browse files
ci: [NGOv2.X] Corrections of CI setup issues (#3329)
This PR focuses on fixing simplifying CI setup by removing some unnecessary complexity and adding comments to describe CI steps 1. UTR command was corrected to use preinstalled UTR on the image instead of downloading it 2. Removed upm-ci package pack definition and converted Code Coverage test to use upm-pvp pack job 3. Simplifies some unnecessary CI commands 4. Added detailed comments regarding CI setup and commands 5. Created CI_README file which describes overall configuration structure. 6. For macOS devices we now use M1 model (Apple Silicon) in contrast to default x64 Intel Mac which introduced a lot of bit-flipping errors --------- Co-authored-by: Noel Stephens <[email protected]>
1 parent 10d5843 commit d79c743

16 files changed

+600
-323
lines changed

Diff for: .yamato/README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Netcode for GameObjects CI Documentation
2+
3+
## Overview
4+
This document provides an overview of the Continuous Integration (CI) implementation for Netcode for GameObjects.
5+
Specifics of each test are described within related files (for example .yamato/package-tests.yml) and this file present high level overview related to overall implementation.
6+
7+
## Test Configurations
8+
CI related files are present inside .yamato/ folder and we can distinguish specific tests
9+
10+
### Helper jobs
11+
- `.yamato/package-pack.yml` responsible for generating package artifacts (.tgz) required for testing and publishing.
12+
- `.yamato/project-pack.yml` responsible for generating package artifacts (.tgz) required for testing and publishing. This packs all packages of a given project.
13+
- `.yamato/_run-all.yml` responsible for grouping tests into groups for easier management (for example "all console tests").
14+
- `.yamato/_triggers.yml` responsible for defining triggers (PR, nightly, weekly etc.) and defining which tests to run.
15+
- `disable-burst-if-requested.py` responsible for helping to disable burst if needed.
16+
- `.yamato/project.metafile` being the central configuration file defining test environments, platforms, projects, editors and other parameters used.
17+
18+
### In-Editor Tests
19+
- `.yamato/package-tests.yml` responsible for running package tests.
20+
- `.yamato/project-tests.yml` responsible for running project tests.
21+
- `.yamato/project-updated-dependencies-test.yml` responsible for running tests after updating dependencies to latest ones.
22+
- `.yamato/project-standards.yml` responsible for running standards check on a package.
23+
- `.yamato/code-coverage.yml` responsible for running code coverage analysis.
24+
- `.yamato/performance-tests.yml` responsible for running performance tests.
25+
- `.yamato/webgl-build.yml` responsible for making a build for webgl platform.
26+
27+
### Standalone Tests
28+
- `.yamato/desktop-standalone-tests.yml` responsible for running tests on standalone desktops.
29+
- `.yamato/console-standalone-test.yml` responsible for running tests on standalone consoles.
30+
- `.yamato/mobile-standalone-test.yml` responsible for running tests on standalone mobiles.
31+
32+
### Wrench jobs
33+
This file is auto generated by wrench and used for automating release process.
34+
Those tests can also be used by our CI as dependencies.
35+
- `.yamato/wrench/api-validation-jobs.yml` responsible for validating api for a given package version (for example if there are no breaking changes when updating patch version)
36+
- `.yamato/wrench/package-pack-jobs.yml` responsible for generating package artifacts (.tgz) required for testing and publishing.
37+
- `.yamato/wrench/preview-a-p-v.yml` responsible for validating PVP (Package Verification Profiles) standards for the package.
38+
- `.yamato/wrench/promotion-jobs.yml` responsible for publishing.
39+
- `.yamato/wrench/publish-trigger.yml` responsible for defining jobs that need to pass in order to publish.
40+
- `.yamato/wrench/recipe-regeneration.yml` responsible for verifying regeneration of wrench recipes (no manual changes).
41+
- `.yamato/wrench/validation-jobs.yml` responsible for running package tests.
42+
- `.yamato/wrench/wrench_config.json` this is the configuration file for wrench.
43+
- `.yamato/generated-scripts/` is a collection of infrastructure instability detection tools.
44+
45+
## Jobs Configuration Structure
46+
This section explains some configuration details that may be confusing while looking at .yml files.
47+
48+
### Job Generation
49+
Our configuration uses a dynamic job generation approach based on the `.yamato/project.metafile` configuration. While it may appear that only one job is defined per file, the system (Yamato) actually generates multiple jobs through nested loops.
50+
Usually only 1 job is defined and then generated with multiple configurations/parameters but in case of standalone tests 2 jobs are defined which are responsible for building and then testing.
51+
52+
### Job Naming Convention
53+
Because the jobs are being generated their names will be filled by given parameters from project.metfaile. For example jobs from .yamato/console-standalone-test may have names like:
54+
- Display Name (in Yamato): `Build testproject - [win, 6000.0, il2cpp]`
55+
- Internal Job Name (used when adding dependency for example): `console_standalone_build_testproject_win_6000.0`
56+
57+
## Platform Support
58+
Currently, the CI implementation supports the following platforms:
59+
1. Console Platforms:
60+
- Switch
61+
- PS4
62+
- PS5
63+
- Xbox360
64+
- XboxOne
65+
2. Mobile Platforms:
66+
- Android
67+
- iOS
68+
3. Desktop Platforms:
69+
- Windows
70+
- Ubuntu
71+
- macOS
72+
4. Unity Editor Versions
73+
- Supports NGOv2.X (6000.0+ editors)
74+
5. Architectures
75+
- x64
76+
- ARM64 (This is present for consoles/mobiles but will be extended. More information is present in specific standalone test files)
77+
78+
## Design Considerations
79+
In theory, we could manually write jobs for every configuration. However, this approach would be more error-prone, especially when modifications or fixes are needed, as it would require keeping track of all configurations.
80+
The downside of our current approach is that it can sometimes impact readability due to the use of nested if and for statements.

Diff for: .yamato/_run-all.yml

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
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+
# DESCRIPTION--------------------------------------------------------------------------
5+
# Those jobs group together related test as dependencies to allow to easily manage running a given set of tests.
6+
# This enables efficient test execution for different validation scenarios
7+
8+
# QUALITY CONSIDERATIONS---------------------------------------------------------------
9+
# It's important to ensure that all dependencies exist (this can be verified in Yamato) since a modification in parameters may result in a given job not being generated, and thus we will not be able to run such erroneous job.
10+
11+
#-----------------------------------------------------------------------------------
12+
413
# Runs all package tests
514
run_all_package_tests:
615
name: Run All Package Tests
@@ -73,7 +82,7 @@ run_all_webgl_builds:
7382
{% for project in projects.default -%}
7483
{% for platform in test_platforms.desktop -%}
7584
{% for editor in validation_editors.all -%}
76-
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform }}_{{ editor }}
85+
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}
7786
{% endfor -%}
7887
{% endfor -%}
7988
{% endfor -%}
@@ -86,7 +95,7 @@ run_all_webgl_builds_trunk:
8695
{% for project in projects.default -%}
8796
{% for platform in test_platforms.desktop -%}
8897
{% for editor in validation_editors.default -%}
89-
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform }}_{{ editor }}
98+
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}
9099
{% endfor -%}
91100
{% endfor -%}
92101
{% endfor -%}
@@ -128,7 +137,7 @@ run_all_project_tests_mobile_standalone:
128137
{% for project in projects.default -%}
129138
{% for platform in test_platforms.mobile_test -%}
130139
{% for editor in validation_editors.all -%}
131-
- .yamato/mobile-standalone-test.yml#run_{{ project.name }}_tests_{{ platform.name }}_{{ editor }}
140+
- .yamato/mobile-standalone-test.yml#mobile_standalone_test_{{ project.name }}_{{ platform.name }}_{{ editor }}
132141
{% endfor -%}
133142
{% endfor -%}
134143
{% endfor -%}
@@ -141,7 +150,7 @@ run_all_project_tests_mobile_standalone_trunk:
141150
{% for project in projects.default -%}
142151
{% for platform in test_platforms.mobile_test -%}
143152
{% for editor in validation_editors.default -%}
144-
- .yamato/mobile-standalone-test.yml#run_{{ project.name }}_tests_{{ platform.name }}_{{ editor }}
153+
- .yamato/mobile-standalone-test.yml#mobile_standalone_test_{{ project.name }}_{{ platform.name }}_{{ editor }}
145154
{% endfor -%}
146155
{% endfor -%}
147156
{% endfor -%}
@@ -154,7 +163,7 @@ run_all_project_tests_console_standalone:
154163
{% for project in projects.default -%}
155164
{% for platform in test_platforms.console_test -%}
156165
{% for editor in validation_editors.all -%}
157-
- .yamato/console-standalone-test.yml#run_{{ project.name }}_tests_{{ platform.name }}_{{ editor }}
166+
- .yamato/console-standalone-test.yml#console_standalone_test_{{ project.name }}_{{ platform.name }}_{{ editor }}
158167
{% endfor -%}
159168
{% endfor -%}
160169
{% endfor -%}
@@ -167,7 +176,7 @@ run_all_project_tests_console_standalone_trunk:
167176
{% for project in projects.default -%}
168177
{% for platform in test_platforms.console_test -%}
169178
{% for editor in validation_editors.default -%}
170-
- .yamato/console-standalone-test.yml#run_{{ project.name }}_tests_{{ platform.name }}_{{ editor }}
179+
- .yamato/console-standalone-test.yml#console_standalone_test_{{ project.name }}_{{ platform.name }}_{{ editor }}
171180
{% endfor -%}
172181
{% endfor -%}
173182
{% endfor -%}

Diff for: .yamato/_triggers.yml

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,44 @@
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+
# DESCRIPTION--------------------------------------------------------------------------
5+
# This configuration defines three main CI trigger patterns:
6+
# 1. Pull Request Validation: Validation performed on PR basis
7+
# 2. Nightly Development: Test set run nightly (validates most important test cases)
8+
# 3. Weekly Full Validation: Test set run weekly (validates all test cases to prevent any suprises)
9+
# Each pattern represents different balance between validation depth, execution time and CI resource usage
10+
11+
# TRIGGER PATTERNS-------------------------------------------------------------------
12+
# Pull Request:
13+
# This test validaes Standards, Package tests, Project tests and Desktop standalone tests to ensure that main platforms are covered
14+
# Triggers on PRs to develop, develop-2.0.0, and release branches
15+
# Focuses on critical validation paths that we should validate before merging PRs
16+
# Cancels previous runs on new commits
17+
# Excludes draft PRs
18+
19+
# Nightly:
20+
# This test validaes same subset as pull_request_trigger with addition of mobile/console tests and webgl builds
21+
# Runs daily on develop-2.0.0 (local configuration)
22+
# Includes all test types but only on trunk. TODO: Add validation for minimum supported editor in nightly
23+
# Adds platform-specific and APV validation
24+
25+
# Weekly:
26+
# This test validaes same subset as develop_nightly but runs per all supported editors as well as executes code coverage test and runs project standards per project
27+
# Runs across all supported editor versions
28+
# Includes code coverage analysis
29+
# Validates all projects and standards
30+
31+
# CONFIGURATION STRUCTURE--------------------------------------------------------------
32+
# Jobs configurations are generated by ensuring that all dependencies are successful.
33+
# The dependencies are taken from _run-all.yml file where we can gather multiple tests into proper sets
34+
35+
# QUALITY CONSIDERATIONS---------------------------------------------------------------
36+
# It's important to ensure that all dependencies exist (this can be verified in Yamato) since a modification in parameters may result in a given job not being generated, and thus we will not be able to run such erroneous job.
37+
38+
39+
40+
#-----------------------------------------------------------------------------------
41+
442
# Run all relevant tasks when a pull request targeting the develop or release branch is created or updated.
543
pull_request_trigger:
644
name: Pull Request Trigger (develop, develop-2.0.0, & release branches)

Diff for: .yamato/code-coverage.yml

+34-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
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
---
3+
4+
# DESCRIPTION--------------------------------------------------------------------------
5+
# This job is responsible for executing package tests with code coverage analysis enabled.
6+
# Coverage analysis provides insights into:
7+
# Test coverage metrics for NGO assemblies
8+
# Line and branch coverage statistics
9+
# Generated HTML reports for coverage visualization
10+
# Additional metrics for coverage analysis
11+
12+
# CONFIGURATION STRUCTURE--------------------------------------------------------------
13+
# Jobs are generated using nested loops through:
14+
# 1. For default platform only (Ubuntu) since coverage would not vary between platforms (no need for checks on more platforms)
15+
# 2. For default editor version (trunk) since coverage would not vary between editors (no need for checks on more editors)
316

4-
# Runs package tests in order to determine code coverage of the NGO package.
5-
# In essence it's performing the same task as .yamato/package-test jobs with the overhead being the measured code coverage
6-
# It's ok for code coverage to be performed only on one platform (default) since code coverage won't change much between those.
7-
# Default platform was chosen (ubuntu) since it's the fastest and most resource friendly with default editor.
17+
#TECHNICAL CONSIDERATIONS---------------------------------------------------------------
18+
# In theory this job also runs package tests, but we don't want to use it as default since is heavier (because of added coverage analysis) and coverage is not changing that often
19+
# Requires Unity Editor installation
20+
# Burst compilation is disabled to ensure accurate coverage measurement
21+
# In order to properly use -coverage-results-path parameter we need to start it with $PWD (which means the absolute path). Otherwise coverage results will not be visible
22+
23+
# QUALITY CONSIDERATIONS--------------------------------------------------------------------
24+
# TODO: somewhere in 2025 we will be able to upload resuls to CodeCov from public repos
25+
# To see where this job is included (in trigger job definitions) look into _triggers.yml file
26+
27+
28+
829
{% for platform in test_platforms.default -%}
930
{% for editor in validation_editors.default -%}
1031
code_coverage_{{ platform.name }}_{{ editor }}:
@@ -13,16 +34,18 @@ code_coverage_{{ platform.name }}_{{ editor }}:
1334
type: {{ platform.type }}
1435
image: {{ platform.image }}
1536
flavor: {{ platform.flavor }}
37+
{% if platform.model %}
38+
model: {{ platform.model }} # This is set only in platforms where we want non-default model to use (more information in project.metafile)
39+
{% endif %}
1640
commands:
17-
- npm install -g upm-ci-utils@stable --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
18-
- unity-downloader-cli -u {{ editor }} -c Editor --fast --wait
19-
- DISPLAY=:0 upm-ci package test -u {{ editor }} --package-path com.unity.netcode.gameobjects --enable-code-coverage --code-coverage-options 'generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.Netcode.Editor,+Unity.Netcode.Runtime' --extra-utr-arg="--extra-editor-arg=--burst-disable-compilation --extra-editor-arg=testCategory --extra-editor-arg=!Performance --timeout=1800 --reruncount=1 --clean-library-on-rerun"
41+
- unity-downloader-cli --fast --wait -u {{ editor }} -c Editor {% if platform.name == "mac" %} --arch arm64 {% endif %} # For macOS we use ARM64 models
42+
- upm-pvp create-test-project test-project --packages "upm-ci~/packages/*.tgz" --unity .Editor
43+
- UnifiedTestRunner --suite=editor --suite=playmode --editor-location=.Editor --testproject=test-project --enable-code-coverage -coverage-results-path=$PWD/test-results/CodeCoverage --coverage-options="generateHtmlReport;generateAdditionalMetrics;assemblyFilters:+Unity.Netcode.Editor,+Unity.Netcode.Runtime" --extra-editor-arg=--burst-disable-compilation --timeout=1800 --reruncount=1 --clean-library-on-rerun --artifacts-path=test-results
2044
artifacts:
2145
logs:
2246
paths:
23-
- "upm-ci~/test-results/**/*"
24-
- "upm-ci~/test-results/CoverageResults/**/*"
47+
- "test-results/**/*"
2548
dependencies:
26-
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}_upmCI
49+
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}
2750
{% endfor -%}
2851
{% endfor -%}

0 commit comments

Comments
 (0)