Skip to content

Commit 3ef5539

Browse files
ci: Setting up conditional CI runs depending on PR comment trigger (#3580)
This PR aims to address the issue of "overdoing" the CI tests which due to distribution times often lead to very long wait times. First thing is that I failed to notice that `targets` and `drafts` conditions are configured as separate items in a list (see PR job trigger changes). In our CI, basic triggers in a list are combined with an OR operator, meaning the job will run if any of the conditions are met. This lead to test being executed on draft PRs. What I'm changing is 1. Tests will correctly **not run** on draft PRs and if PR is not targeting one of specified branches 2. PR trigger tests will execute only if there are changes in package or project. For for example DOCS only changes no tests will run (in the future we can improve that if for example we would have a test that verifies typos etc) This change should improve our workflow with CI as well as save some resources for others **NOTE THAT** By default the PR trigger it's triggered if 1. PR targets develop or release branches 2. PR is not a draft 3. PR changes files in package or TestProjects folders (doesn't run on for example DOCS only changes) Note that in other cases you can trigger it by writing a comment `/ci ngo` in the PR thread (if for example you want to test it on draft PR) ## Additional stuff I also used that occasion to remove disable-burst file. We are not using it and I included more advanced version in #3557 so if we ever need it we can reuse that one. Because of that I will remove it to avoid any confusion ## Steps after approval I will remove the mandatory PR trigger job from branch settings since now it will not always run (eg. only DOCS changes) and would block PRs otherwise ## Backports #3581 ## Testing & QA I verified that 1. PR trigger gets executed correctly when we have package or project changes 4. I verified that the fact of tests running blocks PR from merging ## Documentation I added explanation in jobs comments ## Jira ticket MTT-12903
1 parent e1d07e8 commit 3ef5539

File tree

3 files changed

+37
-127
lines changed

3 files changed

+37
-127
lines changed

.yamato/_triggers.yml

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

44
# 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 surprises)
9-
# Each pattern represents different balance between validation depth, execution time and CI resource usage
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 surprises)
9+
# Each pattern represents different balance between validation depth, execution time and CI resource usage
1010

1111
# TRIGGER PATTERNS-------------------------------------------------------------------
12+
1213
# Pull Request:
13-
# This test validates Standards, Package tests, Project tests and Desktop standalone tests to ensure that main platforms are covered
14-
# Triggers on PRs to develop, develop, 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
14+
# This test validates Standards, Package tests, Project tests and Desktop standalone tests to ensure that main platforms are covered
15+
# Focuses on critical validation paths that we should validate before merging PRs. It also cancels previous runs on new commits
16+
# By default it's triggered if
17+
# 1) PR targets develop, develop-2.0.0 or release branches
18+
# 2) PR is not a draft
19+
# 3) PR changes files in package or testproject folders (doesn't run on for example DOCS only changes)
20+
21+
# Note that in other cases you can trigger it by writing a comment "/ci ngo" in the PR thread
1822

1923
# Nightly:
20-
# This test validates same subset as pull_request_trigger with addition of mobile/console tests and webgl builds
21-
# Runs daily on develop (local configuration)
22-
# Includes all test types but only on trunk.
23-
# Adds platform-specific and APV validation
24+
# This test validates same subset as pull_request_trigger with addition of mobile/console tests and webgl builds
25+
# Runs daily on develop (local configuration)
26+
# Includes all test types but only on trunk.
27+
# Adds platform-specific and APV validation
2428

2529
# Weekly:
26-
# This test validates 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+
# This test validates same subset as develop_nightly but runs per all supported editors as well as executes code coverage test and runs project standards per project
31+
# Runs across all supported editor versions
32+
# Includes code coverage analysis
33+
# Validates all projects and standards
3034

3135
# 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
36+
# Jobs configurations are generated by ensuring that all dependencies are successful.
37+
# The dependencies are taken from _run-all.yml file where we can gather multiple tests into proper sets
3438

3539
# 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.
40+
# 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.
3741

3842

3943
#-----------------------------------------------------------------------------------
4044

45+
4146
# Run all relevant tasks when a pull request targeting the develop or release branch is created or updated.
4247
# In order to have better coverage we run desktop standalone tests with different configurations which allows to mostly cover for different platforms, scripting backends and editor versions.
4348
# This job will FIRST run "run_quick_checks" jobs (defined in _run-all.yml) since it's the dependency of project pack jobs which is on the lowest dependency tier. This runs the fastest checks (like PVP or code standards) and ONLY IF those pass it will run the rest of the tests.
@@ -60,15 +65,18 @@ pull_request_trigger:
6065
- .yamato/desktop-standalone-tests.yml#desktop_standalone_test_testproject_win_il2cpp_6000.0
6166
- .yamato/cmb-service-standalone-tests.yml#cmb_service_standalone_test_testproject_ubuntu_il2cpp_trunk
6267
triggers:
68+
# Note that PR tests will run ONLY if we are changing package/sample code. If changes are let's say docs only no tests will be triggered
69+
# TODO: consider setting up and running tests from Examples/
70+
# TODO: or docs only changes are spelling/link check
71+
expression: |-
72+
pull_request.comment eq "ngo" OR
73+
((pull_request.target eq "develop" OR
74+
pull_request.target eq "develop-2.0.0" OR
75+
pull_request.target match "release/*") AND
76+
NOT pull_request.draft AND
77+
(pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR
78+
pull_request.changes.any match "testproject/**"))
6379
cancel_old_ci: true
64-
pull_requests:
65-
- targets:
66-
only:
67-
- "develop"
68-
- "develop-2.0.0"
69-
- "/release\/.*/"
70-
- drafts: false
71-
7280

7381
# Run all tests on trunk on nightly basis.
7482
# Same subset as pull_request_trigger with addition of mobile/desktop/console tests and webgl builds

.yamato/disable-burst-if-requested.py

Lines changed: 0 additions & 97 deletions
This file was deleted.

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Additional documentation and release notes are available at [Multiplayer Documen
2424

2525
- Fixed issue where a client, under above average latency and packet loss conditions, could receive multiple NetworkTransform state updates in one frame and when processing the state updates only the last state update would be applied to the transform if interpolation was disabled. (#3614)
2626

27-
2827
### Security
2928

3029

0 commit comments

Comments
 (0)