-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run template tests run in parallel to save 15min of run time #17672
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
using Microsoft.Maui.IntegrationTests.Apple; | ||
|
||
[assembly: LevelOfParallelism(2)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the key part of the change. Can adjust in the future higher/lower. |
||
|
||
namespace Microsoft.Maui.IntegrationTests | ||
{ | ||
[Parallelizable(scope: ParallelScope.All)] | ||
public class TemplateTests : BaseBuildTest | ||
{ | ||
[SetUp] | ||
public void TemplateTestsSetUp() | ||
{ | ||
File.Copy(Path.Combine(TestEnvironment.GetMauiDirectory(), "src", "Templates", "tests", "Directory.Build.props"), | ||
Path.Combine(TestDirectory, "Directory.Build.props"), true); | ||
Path.Combine(TestDirectory, "Directory.Build.props"), overwrite: true); | ||
File.Copy(Path.Combine(TestEnvironment.GetMauiDirectory(), "src", "Templates", "tests", "Directory.Build.targets"), | ||
Path.Combine(TestDirectory, "Directory.Build.targets"), true); | ||
Path.Combine(TestDirectory, "Directory.Build.targets"), overwrite: true); | ||
} | ||
|
||
[Test] | ||
|
@@ -30,9 +33,10 @@ public void TemplateTestsSetUp() | |
public void Build(string id, string framework, string config, bool shouldPack) | ||
{ | ||
var projectDir = TestDirectory; | ||
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName, framework), | ||
$"Unable to create template {id}. Check test output for errors."); | ||
|
||
EnableTizen(projectFile); | ||
|
@@ -59,9 +63,10 @@ public void Build(string id, string framework, string config, bool shouldPack) | |
public void BuildUnpackaged(string id, string framework, string config) | ||
{ | ||
var projectDir = TestDirectory; | ||
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName, framework), | ||
$"Unable to create template {id}. Check test output for errors."); | ||
|
||
EnableTizen(projectFile); | ||
|
@@ -81,9 +86,10 @@ public void PublishUnpackaged(string id, string framework, string config) | |
Assert.Ignore("Running Windows templates is only supported on Windows."); | ||
|
||
var projectDir = TestDirectory; | ||
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName, framework), | ||
$"Unable to create template {id}. Check test output for errors."); | ||
|
||
BuildProps.Add("WindowsPackageType=None"); | ||
|
@@ -118,9 +124,10 @@ void AssetExists(string filename) | |
public void PackCoreLib(string id, string framework, string config) | ||
{ | ||
var projectDir = TestDirectory; | ||
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName, framework), | ||
$"Unable to create template {id}. Check test output for errors."); | ||
|
||
EnableTizen(projectFile); | ||
|
@@ -151,9 +158,10 @@ public void PackCoreLib(string id, string framework, string config) | |
public void BuildWithoutPackageReference(string id, string framework, string config) | ||
{ | ||
var projectDir = TestDirectory; | ||
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName, framework), | ||
$"Unable to create template {id}. Check test output for errors."); | ||
|
||
EnableTizen(projectFile); | ||
|
@@ -178,9 +186,10 @@ public void BuildWithoutPackageReference(string id, string framework, string con | |
public void BuildWithDifferentVersionNumber(string id, string config, string display, string version) | ||
{ | ||
var projectDir = TestDirectory; | ||
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir), | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName), | ||
$"Unable to create template {id}. Check test output for errors."); | ||
|
||
EnableTizen(projectFile); | ||
|
@@ -204,19 +213,21 @@ public void CheckEntitlementsForMauiBlazorOnMacCatalyst(string id, string config | |
Assert.Ignore("Running MacCatalyst templates is only supported on Mac."); | ||
|
||
string projectDir = TestDirectory; | ||
string projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); | ||
var projectName = DotnetInternal.GetProjectName(projectDir); | ||
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj"); | ||
|
||
// Note: Debug app is stored in the maccatalyst-x64 folder, while the Release is in parent directory | ||
string appLocation = config == "Release" ? | ||
Path.Combine(projectDir, "bin", config, $"{framework}-maccatalyst", $"{Path.GetFileName(projectDir)}.app") : | ||
Path.Combine(projectDir, "bin", config, $"{framework}-maccatalyst", "maccatalyst-x64", $"{Path.GetFileName(projectDir)}.app"); | ||
Path.Combine(projectDir, "bin", config, $"{framework}-maccatalyst", $"{projectName}.app") : | ||
Path.Combine(projectDir, "bin", config, $"{framework}-maccatalyst", "maccatalyst-x64", $"{projectName}.app"); | ||
string entitlementsPath = Path.Combine(projectDir, "x.xml"); | ||
|
||
List<string> buildWithCodeSignProps = new List<string>(BuildProps) | ||
{ | ||
"EnableCodeSigning=true" | ||
}; | ||
|
||
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), $"Unable to create template {id}. Check test output for errors."); | ||
Assert.IsTrue(DotnetInternal.New(id, projectDir, projectName, framework), $"Unable to create template {id}. Check test output for errors."); | ||
Assert.IsTrue(DotnetInternal.Build(projectFile, config, framework: $"{framework}-maccatalyst", properties: buildWithCodeSignProps, msbuildWarningsAsErrors: true), | ||
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change and other
projectName
stuff is repeated for nearly every test: it's what ensures that the lengthy project names used throughout the tests are not too long for WinUI AppX (see PR description for more info).