Skip to content

Conversation

windxu88
Copy link
Collaborator

@windxu88 windxu88 commented Aug 26, 2025

Description

This PR migrates CI to use Recipe Engine.

In Input CI, tests fall into two categories: functional tests and performance tests.
For each category, tests run on the following Runtime platforms:

  • Editor on all three desktop OS platforms which are Windows, Ubuntu and MacOS
  • Standalone on all three desktop OS platforms
  • Standalone with il2cpp backend on all three desktop OS platforms
  • Mobile platforms including TvOS, iOS and Android. For Android, we cover both mono and il2cpp backends.

In the migration, I created four recipes for both Functional and Performance tests.
For functional tests, they are:

  • EditorFunctionalTests
  • StandaloneFunctionalTests
  • StandaloneIl2CppFunctionalTests
  • MobileFunctionalTests

For performance tests, there are four equivalents:

  • EditorPerformanceTests
  • StandalonePerformanceTests
  • StandaloneIl2CppPerformanceTests
  • MobilePerformanceTests

For editor and standalone tests recipes, the tests will run on WrenchPackage.DefaultEditorPlatforms which are Windows, Mac and Ubuntu. That's what we want.
For mobile tests recipe, I added the following platforms in InputSystemSettings.cs:

  • MobileBuildPlatforms
  • MobileTestPlatforms
    Mobile platform settings are read from mobile_config.json file in .yamato folder.

Another difference between editor/standalone and mobile tests recipes is:

  • Editor/Standalone tests recipes inherit from BaseRecipe
  • Mobile tests recipes inherit from MobileBaseRecipe which inherits BaseRecipe. That's because I need to add support for both mono and il2cpp backends for Android. I did some customization for Android about how to create jobs for it. The details can be seen in MobileBaseRecipe.cs.

The major differences between functional tests recipes and performance tests recipes are in UtrCommand.

  • Functional tests recipes use WithCategory("!Performance") and --enable-code-coverage.
  • Performance tests recipes use .WithCategory("Performance") and WithPerformanceDataReporting.
    Other than that, functional tests recipes and performance tests recipes are very similar.

Please note that: In the old Build & Run jobs on Desktop OS platforms, upm-ci package test can be replaced by Wrench validation jobs. That's why I didn't add it in the recipes. For example, the old PVS tests have been replaced by upm-pvp test in Wrench validation jobs. Wrench validation jobs also run tests inside the package, so there is no need to run package tests in other jobs.

Testing status & QA

Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity:
  • Halo Effect:

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

@windxu88 windxu88 changed the title Migrate ci to recipe engine CHANGE: Migrate ci to recipe engine Aug 26, 2025
@codecov-github-com
Copy link

codecov-github-com bot commented Aug 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@             Coverage Diff             @@
##           develop    #2226      +/-   ##
===========================================
+ Coverage    68.14%   76.70%   +8.56%     
===========================================
  Files          367      465      +98     
  Lines        53685    87919   +34234     
===========================================
+ Hits         36585    67442   +30857     
- Misses       17100    20477    +3377     
Flag Coverage Δ
inputsystem_MacOS_2021.3 5.91% <ø> (?)
inputsystem_MacOS_2021.3_project 78.05% <ø> (?)
inputsystem_MacOS_2022.3 5.37% <ø> (?)
inputsystem_MacOS_2022.3_project 74.58% <ø> (?)
inputsystem_MacOS_6000.0 5.19% <ø> (?)
inputsystem_MacOS_6000.0_project 76.50% <ø> (?)
inputsystem_MacOS_6000.2 5.19% <ø> (?)
inputsystem_MacOS_6000.2_project 76.50% <ø> (?)
inputsystem_MacOS_6000.3 5.19% <ø> (?)
inputsystem_MacOS_6000.3_project 76.50% <ø> (?)
inputsystem_MacOS_6000.4 5.19% <ø> (?)
inputsystem_MacOS_6000.4_project 76.50% <ø> (?)
inputsystem_Ubuntu_2021.3 5.91% <ø> (?)
inputsystem_Ubuntu_2021.3_project 77.96% <ø> (?)
inputsystem_Ubuntu_2022.3 5.38% <ø> (?)
inputsystem_Ubuntu_2022.3_project 74.39% <ø> (?)
inputsystem_Ubuntu_6000.0 5.19% <ø> (?)
inputsystem_Ubuntu_6000.0_project 76.32% <ø> (?)
inputsystem_Ubuntu_6000.2 5.19% <ø> (?)
inputsystem_Ubuntu_6000.2_project 76.32% <ø> (?)
inputsystem_Ubuntu_6000.3 5.19% <ø> (?)
inputsystem_Ubuntu_6000.3_project 76.31% <ø> (?)
inputsystem_Ubuntu_6000.4 5.19% <ø> (?)
inputsystem_Ubuntu_6000.4_project 76.31% <ø> (?)
inputsystem_Windows_2021.3 5.91% <ø> (?)
inputsystem_Windows_2021.3_project 78.20% <ø> (?)
inputsystem_Windows_2022.3 5.37% <ø> (?)
inputsystem_Windows_2022.3_project 74.72% <ø> (?)
inputsystem_Windows_6000.0 5.19% <ø> (?)
inputsystem_Windows_6000.0_project 76.64% <ø> (?)
inputsystem_Windows_6000.2 5.19% <ø> (?)
inputsystem_Windows_6000.2_project 76.64% <ø> (?)
inputsystem_Windows_6000.3 5.19% <ø> (?)
inputsystem_Windows_6000.3_project 76.64% <ø> (?)
inputsystem_Windows_6000.4 5.19% <ø> (?)
inputsystem_Windows_6000.4_project 76.64% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 100 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@windxu88 windxu88 requested a review from stefanunity September 2, 2025 15:35
@windxu88 windxu88 marked this pull request as ready for review September 2, 2025 15:35
Copy link
Collaborator

@stefanunity stefanunity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! While this is now a bunch more files flying around than before, it is going to be easier to keep alive without everyone bolting every new thing onto that one yml file :D
Only two small comments from my side.

.WithRerun(1, true)
.WithPerformanceDataReporting(true)
.WithPerformanceProject("InputSystem")
.WithExtraArgs("--report-performance-data --performance-project-id=InputSystem")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line produces "--report-performance-data --performance-project-id=InputSystem" in the yml cmd line a 2nd time, since the two .Withs above it already say the same thing.
Looks fine for the other performance test recipes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

.WithDependencies(allMobileFunctionalTests)
.WithDependencies(allTvOSFunctionalBuildJobs),

JobBuilder.Create("All Functional Tests")
Copy link
Collaborator

@stefanunity stefanunity Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a trigger could be added for "all functional editor jobs for trunk" to run during development to save some clicks and have a quick CI turnaround before the PR stage? But I'll leave that up to @jfreire-unity to decide. Just a thought.

Copy link
Collaborator

@jfreire-unity jfreire-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good improvement, so thanks for this!

I added some comments to avoid code repetition and questions regarding matching the current functionality.

Also, I think this area would benefit from having a README in case someone in the team needs to do a CI fix. I think a lot of us are not aware of how these CI Recipes so I'll try to book a meeting next week.

I'm not sure how we will "deploy" this. Are we able to test this on demand before landing the PR to make sure we have 1:1 matching with the current jobs that run?

My last comment/nitpick is about the size of the PR. We could have probably done this in smaller chunks so that we wouldn't have so many changes landing. Also would have been easier to review.

Nevertheless, this is great work, and thanks for improving our CI workflow! 🚀 🙏


namespace InputSystem.Cookbook.Recipes;

public abstract class InputBaseRecipe: RecipeBase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick: We're in the InputSystem.Cookbook.Recipes so I would think we don't need Input prefix for inputBaseRecipe, InputMobileBaseRecipe. But this is just my preference and I don't know if without those prefixes, those classes exist elsewhere. You will likely be more into this area so I trust your judgement.

Comment on lines 29 to 70
if (platform.System == SystemType.Android && jobName.Contains("il2cpp"))
{
job.WithCommands(UtrCommand.Run(platform.System, b => b
.WithTestProject($"{ProjectPath}")
.WithEditor(".Editor")
.WithSuite(UtrTestSuiteType.Playmode)
.WithPlatform(platform.System)
.WithCategory("!Performance")
.WithScriptingBackend(ScriptingBackendType.Il2Cpp)
.WithExtraArgs("--clean-library")
.WithRerun(1, true)
.WithBuildOnly()
.WithPlayerSavePath("build/players")
.WithArtifacts("build/logs")));
}
else if(platform.System == SystemType.TvOS)
{
job.WithCommands(UtrCommand.Run(platform.System, b => b
.WithTestProject($"{ProjectPath}")
.WithEditor(".Editor")
.WithSuite(UtrTestSuiteType.Playmode)
.WithCategory("!Performance")
.WithExtraArgs("--platform=tvOS --clean-library")
.WithRerun(1, true)
.WithBuildOnly()
.WithPlayerSavePath("build/players")
.WithArtifacts("build/logs")));
}
else
{
job.WithCommands(UtrCommand.Run(platform.System, b => b
.WithTestProject($"{ProjectPath}")
.WithEditor(".Editor")
.WithSuite(UtrTestSuiteType.Playmode)
.WithPlatform(platform.System)
.WithCategory("!Performance")
.WithExtraArgs("--clean-library")
.WithRerun(1, true)
.WithBuildOnly()
.WithPlayerSavePath("build/players")
.WithArtifacts("build/logs")));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some repeated method calls such as WithArtifacts , WithPlayersSavePath, etc. I wonder if we can make all of the repetition go away so that it's clearer of what's different bewteeen the jobs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you can take this comment to all the other places we are creating jobs. I don't know it the builder pattern needs to follow a specific order as well. Still, I think at least adding the methods that are different depending on the condition we check for would be beneficial to all maintainers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done some refactoring to reduce the duplication. Please re-review.

Comment on lines 46 to 55
job.WithCommands(UtrCommand.Run(platform.System, b => b
.WithTestProject($"{ProjectPath}")
.WithEditor(".Editor")
.WithSuite(UtrTestSuiteType.Playmode)
.WithCategory("!Performance")
.WithExtraArgs("--platform=tvOS --clean-library")
.WithRerun(1, true)
.WithBuildOnly()
.WithPlayerSavePath("build/players")
.WithArtifacts("build/logs")));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a WithPlatform here. Is it expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"WithPlatform" doesn't work with tvOS. Instead I used --platform=tvOS directly.

Comment on lines +75 to +76
if (platform.System == SystemType.IOS && float.Parse(unityVersion) > 6000.2f)
job.WithEnvironmentVariable("UNITY_HANDLEUIINTERRUPTIONS", 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this only done for 6.2 and forward? Maybe some comments explaining this would help understand its need.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added some comments

dotnet run --project Tools/CI/InputSystem.Cookbook.csproj
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When should this be run? Could we actually add a README.md to Tools/CI for us to know how it is setup and what to run when we make changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to run regenerate.sh[bat] when any of following things happen:

  • Changes made to InputSystem.Cookbook project
  • An unity version reaches EOL
  • Trunk version has changed which also means a new version has branched off from Trunk
  • Minimum Editor version of Input package has changed
  • Wrench version is updated

Copy link
Collaborator

@jfreire-unity jfreire-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! Approving to not leave this lingering longer. No blockers for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants