Skip to content

Commit b998fc0

Browse files
authored
ci: Split code coverage into Package Test and Project Test jobs (#4101)
* 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. * ci: Run both coverage jobs on PR and nightly * ci: Use pinnedTrunk for PR coverage and drop package-test job
1 parent 80c55de commit b998fc0

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

.yamato/_triggers.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ pr_code_changes_checks:
8989
# Note that our daily tests will anyway run both test configurations in "minimal supported" and "trunk" configurations
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 }}
92-
# Run code coverage test
93-
- .yamato/code-coverage.yml#code_coverage_ubuntu_{{ validation_editors.default }}
92+
# Run code coverage test (PRs use the pinned "safe" trunk)
93+
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_{{ pinnedTrunk }}
9494
triggers:
9595
expression: |-
9696
(pull_request.comment eq "ngo" OR
@@ -159,8 +159,8 @@ develop_nightly:
159159
- .yamato/project-updated-dependencies-test.yml#updated-dependencies_testproject_NGO_win_6000.0
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
162-
# Run code coverage test
163-
- .yamato/code-coverage.yml#code_coverage_ubuntu_{{ validation_editors.default }}
162+
# Run code coverage test (nightly uses actual trunk)
163+
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_trunk
164164

165165

166166
# Run all tests on weekly bases

.yamato/code-coverage.yml

Lines changed: 17 additions & 12 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 job runs the in-repo testproject tests with code coverage analysis enabled.
6+
# The project tests also exercise the NGO package tests, so a separate package-test coverage job is not needed.
67
# Coverage analysis provides insights into:
78
# Test coverage metrics for NGO assemblies
89
# Line and branch coverage statistics
910
# Generated HTML reports for coverage visualization
1011
# Additional metrics for coverage analysis
1112

1213
# 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)
14+
# Jobs are generated for:
15+
# 1. Default platform only (Ubuntu) since coverage would not vary between platforms (no need for checks on more platforms)
16+
# 2. Two editors: actual "trunk" (used by nightly) and the "pinnedTrunk" safe version (used by PRs).
17+
# Occasionally trunk breaks our tests, so PRs run against a pinned "safe" trunk while nightly runs actual trunk.
1618

1719
#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
1920
# Requires Unity Editor installation
2021
# Burst compilation is disabled to ensure accurate coverage measurement
2122
# 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
2223

2324
# QUALITY CONSIDERATIONS--------------------------------------------------------------------
24-
# To see where this job is included (in trigger job definitions) look into _triggers.yml file
25-
25+
# To see where this job is included (in trigger job definitions) look into _triggers.yml file. Currently:
26+
# [Code Coverage] Project Test runs on PR changes (pr_code_changes_checks, pinnedTrunk) and nightly (develop_nightly, trunk)
2627

28+
{% assign coverage_editors = "trunk," | append: pinnedTrunk | split: "," -%}
2729

2830
{% 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 }}]
31+
{% for project in projects.default -%}
32+
{% for editor in coverage_editors -%}
33+
{% if editor == "trunk" -%}{% assign editor_label = "trunk" -%}{% else -%}{% assign editor_label = "pinnedTrunk" -%}{% endif -%}
34+
code_coverage_project_test_{{ project.name }}_{{ platform.name }}_{{ editor }}:
35+
name: '[Code Coverage] Project Test - NGO {{ project.name }} [{{ platform.name }}, {{ editor }}]'
3236
agent:
3337
type: {{ platform.type }}
3438
image: {{ platform.image }}
@@ -38,13 +42,14 @@ code_coverage_{{ platform.name }}_{{ editor }}:
3842
{% endif %}
3943
commands:
4044
- unity-downloader-cli --fast --wait -u {{ editor }} -c Editor {% if platform.name == "mac" %} --arch arm64 {% endif %} # For macOS we use ARM64 models
41-
- upm-pvp create-test-project test-project --packages "upm-ci~/packages/*.tgz" --unity .Editor
42-
- UnifiedTestRunner --suite=editor --suite=playmode --editor-location=.Editor --testproject=test-project --enable-code-coverage --coverage-upload-options="reportsDir:$PWD/test-results/CoverageResults;name:NGOv2_{{ platform.name }}_{{ editor }};flags:NGOv2_{{ 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
45+
- 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_label }};flags:NGOv2_project_{{ project.name }}_{{ platform.name }}_{{ editor_label }};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
4346
artifacts:
4447
logs:
4548
paths:
4649
- "test-results/**/*"
4750
dependencies:
51+
- .yamato/_run-all.yml#run_quick_checks # initial checks to perform fast validation of common errors
4852
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}
4953
{% endfor -%}
5054
{% endfor -%}
55+
{% endfor -%}

0 commit comments

Comments
 (0)