Skip to content

Commit cd0faed

Browse files
committed
ci: Split code coverage into Package Test and Project Test jobs
Convert the existing coverage job to [Code Coverage] Package Test - NGO [ubuntu, trunk] and add [Code Coverage] Project Test - NGO testproject [ubuntu, trunk]. Wire Package Test into PR/nightly triggers and Project Test into the weekly run.
1 parent 80c55de commit cd0faed

2 files changed

Lines changed: 41 additions & 12 deletions

File tree

.yamato/_triggers.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pr_code_changes_checks:
9090
- .yamato/desktop-standalone-tests.yml#desktop_standalone_test_testproject_ubuntu_il2cpp_{{ pinnedTrunk }}
9191
- .yamato/cmb-service-standalone-tests.yml#cmb_service_standalone_test_testproject_ubuntu_il2cpp_{{ pinnedTrunk }}
9292
# Run code coverage test
93-
- .yamato/code-coverage.yml#code_coverage_ubuntu_{{ validation_editors.default }}
93+
- .yamato/code-coverage.yml#code_coverage_package_test_ubuntu_trunk
9494
triggers:
9595
expression: |-
9696
(pull_request.comment eq "ngo" OR
@@ -160,7 +160,7 @@ develop_nightly:
160160
# 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
161161
- .yamato/vetting-test.yml#vetting_test
162162
# Run code coverage test
163-
- .yamato/code-coverage.yml#code_coverage_ubuntu_{{ validation_editors.default }}
163+
- .yamato/code-coverage.yml#code_coverage_package_test_ubuntu_trunk
164164

165165

166166
# Run all tests on weekly bases
@@ -191,3 +191,5 @@ develop_weekly_trunk:
191191
- .yamato/_run-all.yml#run_all_webgl_builds
192192
# Run Runtime tests against CMB service
193193
- .yamato/_run-all.yml#run_all_project_tests_cmb_service
194+
# Run code coverage on the testproject project tests
195+
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_trunk

.yamato/code-coverage.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,37 @@
22
---
33

44
# DESCRIPTION--------------------------------------------------------------------------
5-
# This job is responsible for executing package tests with code coverage analysis enabled.
5+
# This file defines package/project tests with code coverage analysis enabled.
66
# Coverage analysis provides insights into:
77
# Test coverage metrics for NGO assemblies
88
# Line and branch coverage statistics
99
# Generated HTML reports for coverage visualization
1010
# Additional metrics for coverage analysis
11+
# Two jobs are defined:
12+
# [Code Coverage] Package Test - runs the package's own tests (from the packed .tgz) with coverage
13+
# [Code Coverage] Project Test - runs the in-repo testproject tests with coverage
1114

1215
# 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)
16+
# Jobs are generated for:
17+
# 1. Default platform only (Ubuntu) since coverage would not vary between platforms (no need for checks on more platforms)
18+
# 2. Trunk editor only since coverage would not vary between editors (no need for checks on more editors)
1619

1720
#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
21+
# In theory these jobs also run tests, but we don't use them as default since they are heavier (because of added coverage analysis) and coverage is not changing that often
1922
# Requires Unity Editor installation
2023
# Burst compilation is disabled to ensure accurate coverage measurement
2124
# 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
2225

2326
# QUALITY CONSIDERATIONS--------------------------------------------------------------------
24-
# To see where this job is included (in trigger job definitions) look into _triggers.yml file
25-
27+
# To see where these jobs are included (in trigger job definitions) look into _triggers.yml file. Currently:
28+
# [Code Coverage] Package Test runs on PR changes (pr_code_changes_checks) and nightly (develop_nightly)
29+
# [Code Coverage] Project Test runs weekly (develop_weekly_trunk)
2630

31+
{% assign editor = "trunk" -%}
2732

2833
{% for platform in test_platforms.default -%}
29-
{% for editor in validation_editors.default -%}
30-
code_coverage_{{ platform.name }}_{{ editor }}:
31-
name: Code Coverage - NGO [{{ platform.name }}, {{ editor }}]
34+
code_coverage_package_test_{{ platform.name }}_{{ editor }}:
35+
name: '[Code Coverage] Package Test - NGO [{{ platform.name }}, {{ editor }}]'
3236
agent:
3337
type: {{ platform.type }}
3438
image: {{ platform.image }}
@@ -47,4 +51,27 @@ code_coverage_{{ platform.name }}_{{ editor }}:
4751
dependencies:
4852
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}
4953
{% endfor -%}
54+
55+
{% for platform in test_platforms.default -%}
56+
{% for project in projects.default -%}
57+
code_coverage_project_test_{{ project.name }}_{{ platform.name }}_{{ editor }}:
58+
name: '[Code Coverage] Project Test - NGO {{ project.name }} [{{ platform.name }}, {{ editor }}]'
59+
agent:
60+
type: {{ platform.type }}
61+
image: {{ platform.image }}
62+
flavor: {{ platform.flavor }}
63+
{% if platform.model %}
64+
model: {{ platform.model }} # This is set only in platforms where we want non-default model to use (more information in project.metafile)
65+
{% endif %}
66+
commands:
67+
- unity-downloader-cli --fast --wait -u {{ editor }} -c Editor {% if platform.name == "mac" %} --arch arm64 {% endif %} # For macOS we use ARM64 models
68+
- UnifiedTestRunner --testproject={{ project.path }} --suite=editor --suite=playmode --editor-location=.Editor --enable-code-coverage --coverage-upload-options="reportsDir:$PWD/test-results/CoverageResults;name:NGOv2_project_{{ project.name }}_{{ platform.name }}_{{ editor }};flags:NGOv2_project_{{ project.name }}_{{ platform.name }}_{{ editor }};verbose" --coverage-results-path=$PWD/test-results/CoverageResults --coverage-options="generateHtmlReport;generateAdditionalMetrics;assemblyFilters:+Unity.Netcode.Editor,+Unity.Netcode.Runtime" --extra-editor-arg=--burst-disable-compilation --timeout={{ test_timeout }} --rerun-strategy=Test --retry={{ num_test_retries }} --clean-library-on-rerun --artifacts-path=test-results
69+
artifacts:
70+
logs:
71+
paths:
72+
- "test-results/**/*"
73+
dependencies:
74+
- .yamato/_run-all.yml#run_quick_checks # initial checks to perform fast validation of common errors
75+
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}
76+
{% endfor -%}
5077
{% endfor -%}

0 commit comments

Comments
 (0)