Skip to content

Commit ce72070

Browse files
committed
ci: Use pinnedTrunk for PR coverage and drop package-test job
1 parent 77c56eb commit ce72070

2 files changed

Lines changed: 14 additions & 38 deletions

File tree

.yamato/_triggers.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +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_package_test_ubuntu_trunk
94-
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_trunk
92+
# Run code coverage test (PRs use the pinned "safe" trunk)
93+
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_{{ pinnedTrunk }}
9594
triggers:
9695
expression: |-
9796
(pull_request.comment eq "ngo" OR
@@ -160,8 +159,7 @@ develop_nightly:
160159
- .yamato/project-updated-dependencies-test.yml#updated-dependencies_testproject_NGO_win_6000.0
161160
# 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
162161
- .yamato/vetting-test.yml#vetting_test
163-
# Run code coverage test
164-
- .yamato/code-coverage.yml#code_coverage_package_test_ubuntu_trunk
162+
# Run code coverage test (nightly uses actual trunk)
165163
- .yamato/code-coverage.yml#code_coverage_project_test_testproject_ubuntu_trunk
166164

167165

.yamato/code-coverage.yml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,35 @@
22
---
33

44
# DESCRIPTION--------------------------------------------------------------------------
5-
# This file defines package/project 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
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
1412

1513
# CONFIGURATION STRUCTURE--------------------------------------------------------------
1614
# Jobs are generated for:
1715
# 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)
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.
1918

2019
#TECHNICAL CONSIDERATIONS---------------------------------------------------------------
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
2220
# Requires Unity Editor installation
2321
# Burst compilation is disabled to ensure accurate coverage measurement
2422
# 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
2523

2624
# QUALITY CONSIDERATIONS--------------------------------------------------------------------
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 on PR changes (pr_code_changes_checks) and nightly (develop_nightly)
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)
3027

31-
{% assign editor = "trunk" -%}
32-
33-
{% for platform in test_platforms.default -%}
34-
code_coverage_package_test_{{ platform.name }}_{{ editor }}:
35-
name: '[Code Coverage] Package Test - NGO [{{ platform.name }}, {{ editor }}]'
36-
agent:
37-
type: {{ platform.type }}
38-
image: {{ platform.image }}
39-
flavor: {{ platform.flavor }}
40-
{% if platform.model %}
41-
model: {{ platform.model }} # This is set only in platforms where we want non-default model to use (more information in project.metafile)
42-
{% endif %}
43-
commands:
44-
- unity-downloader-cli --fast --wait -u {{ editor }} -c Editor {% if platform.name == "mac" %} --arch arm64 {% endif %} # For macOS we use ARM64 models
45-
- upm-pvp create-test-project test-project --packages "upm-ci~/packages/*.tgz" --unity .Editor
46-
- 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
47-
artifacts:
48-
logs:
49-
paths:
50-
- "test-results/**/*"
51-
dependencies:
52-
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}
53-
{% endfor -%}
28+
{% assign coverage_editors = "trunk," | append: pinnedTrunk | split: "," -%}
5429

5530
{% for platform in test_platforms.default -%}
5631
{% 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 -%}
5734
code_coverage_project_test_{{ project.name }}_{{ platform.name }}_{{ editor }}:
5835
name: '[Code Coverage] Project Test - NGO {{ project.name }} [{{ platform.name }}, {{ editor }}]'
5936
agent:
@@ -65,7 +42,7 @@ code_coverage_project_test_{{ project.name }}_{{ platform.name }}_{{ editor }}:
6542
{% endif %}
6643
commands:
6744
- 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
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
6946
artifacts:
7047
logs:
7148
paths:
@@ -75,3 +52,4 @@ code_coverage_project_test_{{ project.name }}_{{ platform.name }}_{{ editor }}:
7552
- .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }}
7653
{% endfor -%}
7754
{% endfor -%}
55+
{% endfor -%}

0 commit comments

Comments
 (0)