diff --git a/.github/actions/enumerate-tests/action.yml b/.github/actions/enumerate-tests/action.yml index f25cbe4ce13..9129374ffaa 100644 --- a/.github/actions/enumerate-tests/action.yml +++ b/.github/actions/enumerate-tests/action.yml @@ -49,7 +49,7 @@ runs: "/t:Build;ExtractTestClassNames" /bl:${{ github.workspace }}/artifacts/log/Debug/BuildTemplatesTests.binlog -p:ExtractTestClassNamesForHelix=true - -p:ArchiveTests=true + -p:PrepareForHelix=true -p:ExtractTestClassNamesPrefix=Aspire.Templates.Tests -p:InstallBrowsersForPlaywright=false diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ffa66ee7217..d0c78893bf6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -160,8 +160,8 @@ jobs: CI: false run: > ${{ env.BUILD_SCRIPT }} -restore -ci -build -projects ${{ env.TEST_PROJECT_PATH }} - /p:ArchiveTests=true - /bl:${{ github.workspace }}/artifacts/log/Debug/ArchiveTests.binlog + /p:PrepareForHelix=true + /bl:${{ github.workspace }}/artifacts/log/Debug/PrepareForHelix.binlog # Workaround for bug in Azure Functions Worker SDK. See https://github.com/Azure/azure-functions-dotnet-worker/issues/2969. - name: Rebuild for Azure Functions project diff --git a/eng/Testing.props b/eng/Testing.props index 327a5822c2f..f43be60cb0a 100644 --- a/eng/Testing.props +++ b/eng/Testing.props @@ -1,4 +1,16 @@ + + true + + + true + true + true + true + true + true + + <_QuarantinedTestRunAdditionalArgs>-trait "quarantined=true" <_NonQuarantinedTestRunAdditionalArgs>-notrait "quarantined=true" diff --git a/eng/Testing.targets b/eng/Testing.targets index faf2349bae2..b41cd7ceb59 100644 --- a/eng/Testing.targets +++ b/eng/Testing.targets @@ -1,3 +1,96 @@ + + + + + true + + + true + + true + + + + false + true + + false + true + + false + true + + false + + + + + true + + + false + + + false + + + false + + + + + + + + + + <_IsGitHubActionsRunner>$(IsGitHubActionsRunner) + <_IsGitHubActionsRunner Condition="'$(_IsGitHubActionsRunner)' == ''">false + <_IsAzdoCIRunner>$(IsAzdoCIRunner) + <_IsAzdoCIRunner Condition="'$(_IsAzdoCIRunner)' == ''">false + <_IsAzdoHelixRunner>$(IsAzdoHelixRunner) + <_IsAzdoHelixRunner Condition="'$(_IsAzdoHelixRunner)' == ''">false + + + <_Runner Include=" - GitHub Actions: $(_IsGitHubActionsRunner)" /> + <_Runner Include=" - Azure DevOps: $(_IsAzdoCIRunner)" /> + <_Runner Include=" - Helix: $(_IsAzdoHelixRunner)" /> + <_Requirement Include=" - GitHub Actions: $(RunOnGithubActions) (Windows: $(RunOnGithubActionsWindows) / Linux: $(RunOnGithubActionsLinux))" /> + <_Requirement Include=" - Azure DevOps: $(RunOnAzdoCI) (Windows: $(RunOnAzdoCIWindows) / Linux: $(RunOnAzdoCILinux))" /> + <_Requirement Include=" - Helix: $(RunOnAzdoHelix) (Windows: $(RunOnAzdoHelixWindows) / Linux: $(RunOnAzdoHelixLinux))" /> + + + + <_NewLine>%0D%0A + <_RunnerList>@(_Runner, '%0D%0A') + <_RequirementList>@(_Requirement, '$(_NewLine)') + + + + + diff --git a/eng/pipelines/templates/BuildAndTest.yml b/eng/pipelines/templates/BuildAndTest.yml index fc2b4ee4f8a..2f1c385dbcf 100644 --- a/eng/pipelines/templates/BuildAndTest.yml +++ b/eng/pipelines/templates/BuildAndTest.yml @@ -46,7 +46,7 @@ steps: -restore -build -configuration ${{ parameters.buildConfig }} -pack - /p:ArchiveTests=${{ lower(eq(parameters.runHelixTests, 'true')) }} + /p:PrepareForHelix=${{ lower(eq(parameters.runHelixTests, 'true')) }} /bl:${{ parameters.repoLogPath }}/build.binlog $(_OfficialBuildIdArgs) displayName: Build diff --git a/tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj b/tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj index c92a8090cd0..24502b76997 100644 --- a/tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj +++ b/tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj @@ -5,7 +5,10 @@ enable enable false - false + + + false + false diff --git a/tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj b/tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj index 219b3f2531c..170beebab12 100644 --- a/tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj +++ b/tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj @@ -11,7 +11,9 @@ true true - false + + false + false diff --git a/tests/Aspire.Elastic.Clients.Elasticsearch.Tests/Aspire.Elastic.Clients.Elasticsearch.Tests.csproj b/tests/Aspire.Elastic.Clients.Elasticsearch.Tests/Aspire.Elastic.Clients.Elasticsearch.Tests.csproj index 9927f79da36..25297f25478 100644 --- a/tests/Aspire.Elastic.Clients.Elasticsearch.Tests/Aspire.Elastic.Clients.Elasticsearch.Tests.csproj +++ b/tests/Aspire.Elastic.Clients.Elasticsearch.Tests/Aspire.Elastic.Clients.Elasticsearch.Tests.csproj @@ -3,9 +3,9 @@ $(DefaultTargetFramework) - - true - false + + false + false diff --git a/tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj b/tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj index c5284c6947a..5694b015626 100644 --- a/tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj +++ b/tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj @@ -2,11 +2,10 @@ $(DefaultTargetFramework) - - false - - false - true + + false + false + false true diff --git a/tests/Aspire.Hosting.Docker.Tests/Aspire.Hosting.Docker.Tests.csproj b/tests/Aspire.Hosting.Docker.Tests/Aspire.Hosting.Docker.Tests.csproj index 881d4c57f99..f5cb482b6ef 100644 --- a/tests/Aspire.Hosting.Docker.Tests/Aspire.Hosting.Docker.Tests.csproj +++ b/tests/Aspire.Hosting.Docker.Tests/Aspire.Hosting.Docker.Tests.csproj @@ -2,13 +2,14 @@ $(DefaultTargetFramework) - - $(NoWarn); - ASPIREHOSTINGPYTHON001; - - - false + $(NoWarn);ASPIREHOSTINGPYTHON001; + + + false + false diff --git a/tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj b/tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj index 8a3e6ae2da7..f9fc3a5b311 100644 --- a/tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj +++ b/tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj @@ -5,8 +5,10 @@ enable enable false - true - false + + + false + false diff --git a/tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj b/tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj index 7d170657936..a2d06c1735a 100644 --- a/tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj +++ b/tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj @@ -6,7 +6,10 @@ CS8002: Referenced assembly does not have a strong name. KubernetesClient package is unsigned, we ignore that warning on purpose --> $(NoWarn);CS8002 - false + + + false + false diff --git a/tests/Aspire.Oracle.EntityFrameworkCore.Tests/Aspire.Oracle.EntityFrameworkCore.Tests.csproj b/tests/Aspire.Oracle.EntityFrameworkCore.Tests/Aspire.Oracle.EntityFrameworkCore.Tests.csproj index 41be1df65ff..0d25e41b7b0 100644 --- a/tests/Aspire.Oracle.EntityFrameworkCore.Tests/Aspire.Oracle.EntityFrameworkCore.Tests.csproj +++ b/tests/Aspire.Oracle.EntityFrameworkCore.Tests/Aspire.Oracle.EntityFrameworkCore.Tests.csproj @@ -2,7 +2,6 @@ $(AllTargetFrameworks) - true diff --git a/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj b/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj index 18be600b7f7..2b048c12806 100644 --- a/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj +++ b/tests/Aspire.Playground.Tests/Aspire.Playground.Tests.csproj @@ -4,13 +4,12 @@ $(DefaultTargetFramework) true - true + false - - true - - false - true + + false + false + false staging-archive\ @@ -89,7 +88,7 @@ - + diff --git a/tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj b/tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj index 6b50c7c40ac..7e9cb00475b 100644 --- a/tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj +++ b/tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj @@ -11,10 +11,10 @@ $(TestArchiveTestsDirForTemplateTests) true - true + true true - true + true Aspire.Templates.Tests $(RunSettingsFilePath) true - $(RepoRoot)tests\helix\xunit.runner.json + $(RepoRoot)tests\helix\xunit.runner.json $(RepositoryEngineeringDir)testing\xunit.runner.json - - true - true - - true @@ -28,7 +19,7 @@ + Condition=" '$(IsTestProject)' == 'true' and '$(PrepareForHelix)' == 'true' and '$(RunOnAzdoHelix)' == 'true' and '$(IsTestUtilityProject)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'"> $(OutDir) @@ -44,7 +35,7 @@ - + diff --git a/tests/README.md b/tests/README.md index 5f622f9c182..6f00d2e77ff 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,19 +1,26 @@ # Helix -The helix CI job builds `tests/helix/send-to-helix-ci.proj`, which in turns builds the `Test` target on `tests/helix/send-to-helix-inner.proj`. This inner project uses the Helix SDK to construct `@(HelixWorkItem)`s, and send them to helix to run. +The Helix CI job builds `tests/helix/send-to-helix-ci.proj`, which in turns builds the `Test` target on `tests/helix/send-to-helix-inner.proj`. This inner project uses the Helix SDK to construct `@(HelixWorkItem)`s, and send them to Helix to run. - `tests/helix/send-to-helix-basictests.targets` - this prepares all the tests that don't need special preparation -- `tests/helix/send-to-helix-endtoend-tests.targets` - this is for tests that require a sdk+workload installed +- `tests/helix/send-to-helix-endtoend-tests.targets` - this is for tests that require a SDK+workload installed -## Install sdk+workload from artifacts +## Install SDK+workload from artifacts 1. `.\build.cmd -pack` 2. `dotnet build tests\workloads.proj` -.. which results in `artifacts\bin\dotnet-tests` which has a sdk (version from `global.json`) with the `aspire` workload installed using packs from `artifacts/packages`. +.. which results in `artifacts\bin\dotnet-tests` which has a SDK (version from `global.json`) with the `aspire` workload installed using packs from `artifacts/packages`. ## Controlling test runs on CI -- Tests on PRs run in github actions. Individual test projects can be disabled for PRs with the property `$(RunTestsOnGithubActions)` which defaults to `true`. +- Tests on pull-requests run in GitHub Actions. Individual test projects can be opted-out by setting appropriate MSBuild properties: + - `false` and/or + - `false`. -- Tests for rolling builds run on the build machine, and helix. Use `$(RunTestsOnHelix)` which defaults to `true`. If set to `false` then it would run on the build machine. But to skip the tests completely set `$(SkipTests)=true` also. +- Tests for rolling builds run on the build machine and Helix. +Individual test projects can be opted-out by setting appropriate MSBuild properties: + - `false` and/or + - `false` and/or + - `false` and/or + - `false`. diff --git a/tests/Shared/RepoTesting/Aspire.RepoTesting.targets b/tests/Shared/RepoTesting/Aspire.RepoTesting.targets index deb1a291271..2681b98d267 100644 --- a/tests/Shared/RepoTesting/Aspire.RepoTesting.targets +++ b/tests/Shared/RepoTesting/Aspire.RepoTesting.targets @@ -37,7 +37,7 @@ - true + true true $(IntermediateOutputPath)Directory.Packages.Versions.props @@ -93,7 +93,9 @@ - + $(OutDir)$(DeployOutsideOfRepoSupportFilesRelativeDir)