Skip to content

Commit cec531e

Browse files
authored
Run test template tests with Arcade (#51020)
2 parents e55c60d + 537aa47 commit cec531e

File tree

5 files changed

+41
-61
lines changed

5 files changed

+41
-61
lines changed

.vsts-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ extends:
102102
oneESCompat:
103103
templateFolderName: templates-official
104104
publishTaskPrefix: 1ES.
105+
populateInternalRuntimeVariables: true
105106
runtimeSourceProperties: /p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
106107
locBranch: release/10.0.1xx
107108
# WORKAROUND: BinSkim requires the folder exist prior to scanning.
@@ -141,6 +142,14 @@ extends:
141142
_SignType: real
142143
dependsOn: Official_windows_x64
143144
downloadManifestMsiPackages: true
145+
### TestTemplatesCG ###
146+
# Note: This job is only used to allow the test templates to be built locally on the agent as opposed to Helix.
147+
# The tests acquire the templates' PackageReferences from NuGet, which allows them to be scanned by CG (component governance).
148+
# CG is only ran internally, so this job makes sense to only run alongside of the official jobs.
149+
- categoryName: TestTemplatesCG
150+
testProjects: $(Build.SourcesDirectory)/test/dotnet-new.IntegrationTests/dotnet-new.IntegrationTests.csproj
151+
testRunnerAdditionalArguments: -class Microsoft.DotNet.Cli.New.IntegrationTests.DotnetNewTestTemplatesTests
152+
publishXunitResults: true
144153

145154
############### LINUX ###############
146155
- template: /eng/pipelines/templates/jobs/sdk-job-matrix.yml@self
@@ -153,6 +162,7 @@ extends:
153162
oneESCompat:
154163
templateFolderName: templates-official
155164
publishTaskPrefix: 1ES.
165+
populateInternalRuntimeVariables: true
156166
runtimeSourceProperties: /p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
157167
${{ if and(eq(parameters.runTestBuild, false), ne(variables['Build.Reason'], 'PullRequest')) }}:
158168
timeoutInMinutes: 90
@@ -235,6 +245,7 @@ extends:
235245
oneESCompat:
236246
templateFolderName: templates-official
237247
publishTaskPrefix: 1ES.
248+
populateInternalRuntimeVariables: true
238249
runtimeSourceProperties: /p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
239250
${{ if and(eq(parameters.runTestBuild, false), ne(variables['Build.Reason'], 'PullRequest')) }}:
240251
timeoutInMinutes: 90
@@ -260,6 +271,8 @@ extends:
260271
vmImage: macOS-latest
261272
os: macOS
262273
helixTargetQueue: osx.13.arm64
274+
populateInternalRuntimeVariables: true
275+
runtimeSourceProperties: /p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
263276
macOSJobParameterSets:
264277
- categoryName: TestBuild
265278
targetArchitecture: arm64
@@ -270,7 +283,9 @@ extends:
270283
- template: /eng/dotnet-format/dotnet-format-integration.yml@self
271284
parameters:
272285
oneESCompat:
286+
templateFolderName: templates-official
273287
publishTaskPrefix: 1ES.
288+
populateInternalRuntimeVariables: true
274289
runtimeSourceProperties: /p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
275290

276291
############### PUBLISH STAGE ###############

build/RunTestTemplateTests.ps1

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

eng/dotnet-format/dotnet-format-integration.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ parameters:
22
- name: oneESCompat
33
type: object
44
default:
5+
templateFolderName: templates
56
publishTaskPrefix: ''
67

78
- name: TestArguments
@@ -63,6 +64,9 @@ parameters:
6364
- name: runtimeSourceProperties
6465
type: string
6566
default: ''
67+
- name: populateInternalRuntimeVariables
68+
type: boolean
69+
default: false
6670

6771
jobs:
6872
- job: Formatting_Check
@@ -77,8 +81,11 @@ jobs:
7781
os: windows
7882
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
7983
steps:
80-
- template: /eng/common/templates/steps/enable-internal-runtimes.yml
81-
- template: /eng/common/templates/steps/enable-internal-sources.yml
84+
- ${{ if eq(parameters.populateInternalRuntimeVariables, true) }}:
85+
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/steps/enable-internal-sources.yml
86+
parameters:
87+
legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw)
88+
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/steps/enable-internal-runtimes.yml
8289
- script: .\restore.cmd ${{ parameters.runtimeSourceProperties }}
8390
displayName: 🟣 Restore dependencies
8491
- script: |
@@ -106,8 +113,11 @@ jobs:
106113
os: windows
107114
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
108115
steps:
109-
- template: /eng/common/templates/steps/enable-internal-runtimes.yml
110-
- template: /eng/common/templates/steps/enable-internal-sources.yml
116+
- ${{ if eq(parameters.populateInternalRuntimeVariables, true) }}:
117+
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/steps/enable-internal-sources.yml
118+
parameters:
119+
legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw)
120+
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/steps/enable-internal-runtimes.yml
111121
- script: eng\dotnet-format\integration-test.cmd -repo '${{ testArgs._repo }}' -branchName '${{ testArgs._branchName }}' -sha '${{ testArgs._sha }}' -targetSolution '${{ testArgs._targetSolution }}' -useParentSdk ${{ testArgs._useParentSdk }} -testPath '$(Agent.TempDirectory)\temp' -stage 'prepare' -runtimeSourceProperties '${{ parameters.runtimeSourceProperties }}'
112122
displayName: 🟣 Prepare ${{ testArgs._repoName }} for formatting
113123

eng/pipelines/templates/jobs/sdk-build.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ parameters:
1212
testProjects: $(Build.SourcesDirectory)/test/UnitTests.proj
1313
publishRetryConfig: false
1414
publishXunitResults: false
15+
testRunnerAdditionalArguments: ''
1516
enableSbom: true
17+
populateInternalRuntimeVariables: false
1618
timeoutInMinutes: 150
1719
### ENV VARS ###
1820
testFullMSBuild: false
@@ -71,11 +73,11 @@ jobs:
7173
targetPath: $(Build.SourcesDirectory)/eng/BuildConfiguration
7274
artifactName: BuildConfiguration
7375

74-
# Populate internal runtime variables.
75-
- template: /eng/common/templates/steps/enable-internal-sources.yml
76-
parameters:
77-
legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw)
78-
- template: /eng/common/templates/steps/enable-internal-runtimes.yml
76+
- ${{ if eq(parameters.populateInternalRuntimeVariables, true) }}:
77+
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/steps/enable-internal-sources.yml
78+
parameters:
79+
legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw)
80+
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/steps/enable-internal-runtimes.yml
7981

8082
- ${{ if eq(parameters.downloadManifestMsiPackages, true) }}:
8183
- task: DownloadBuildArtifacts@1
@@ -84,7 +86,7 @@ jobs:
8486
downloadPath: $(Build.SourcesDirectory)/artifacts/downloaded-manifest-msi-packages
8587
itemPattern: '**/*Manifest-*.Msi.*.nupkg'
8688
checkDownloadedFiles: true
87-
displayName: Download Manifest msi packages
89+
displayName: 🟣 Download Manifest MSI Packages
8890

8991
############### BUILDING ###############
9092
- ${{ if eq(parameters.pool.os, 'windows') }}:
@@ -105,10 +107,6 @@ jobs:
105107
BuildConfig: $(buildConfiguration)
106108
TestFullMSBuild: ${{ parameters.testFullMSBuild }}
107109

108-
- ${{ if eq(parameters.targetArchitecture, 'x64') }}:
109-
- powershell: build/RunTestTemplateTests.ps1
110-
displayName: 🟣 Run Test Templates Tests
111-
112110
- ${{ else }}:
113111
- script: |
114112
source $(Build.SourcesDirectory)/eng/common/native/init-os-and-arch.sh
@@ -141,12 +139,14 @@ jobs:
141139
- script: $(Build.SourcesDirectory)/artifacts/bin/redist/$(buildConfiguration)/dotnet/dotnet workload install wasm-tools --skip-manifest-update
142140
workingDirectory: $(Build.SourcesDirectory)/artifacts/bin
143141
displayName: 🟣 Install wasm-tools Workload
142+
144143
# For the /p:Projects syntax for PowerShell, see: https://github.com/dotnet/msbuild/issues/471#issuecomment-1146466335
145144
- ${{ if eq(parameters.pool.os, 'windows') }}:
146145
- powershell: eng/common/build.ps1
147146
-restore -test -ci -prepareMachine -nativeToolsOnMachine
148147
-configuration $(buildConfiguration)
149148
/p:Projects=\`"${{ replace(parameters.testProjects, ';', '`;') }}\`"
149+
/p:TestRunnerAdditionalArguments="${{ parameters.testRunnerAdditionalArguments }}"
150150
/p:TargetArchitecture=${{ parameters.targetArchitecture }}
151151
${{ parameters.runtimeSourceProperties }}
152152
/p:CustomHelixTargetQueue=${{ parameters.helixTargetQueue }}
@@ -159,6 +159,7 @@ jobs:
159159
HelixAccessToken: $(HelixApiAccessToken)
160160
RunAoTTests: ${{ parameters.runAoTTests }}
161161
TestFullMSBuild: ${{ parameters.testFullMSBuild }}
162+
162163
- ${{ else }}:
163164
# For the /p:Projects syntax for Bash, see: https://github.com/dotnet/msbuild/issues/471#issuecomment-1690189034
164165
# The /p:CustomHelixTargetQueue syntax is: <queue-name>@<container-url>
@@ -167,6 +168,7 @@ jobs:
167168
-restore -test -ci -prepareMachine
168169
-configuration $(buildConfiguration)
169170
'/p:Projects="${{ parameters.testProjects }}"'
171+
/p:TestRunnerAdditionalArguments="${{ parameters.testRunnerAdditionalArguments }}"
170172
/p:TargetArchitecture=${{ parameters.targetArchitecture }}
171173
/p:TargetRid=${{ parameters.runtimeIdentifier }}
172174
${{ parameters.osProperties }}

eng/pipelines/templates/jobs/sdk-job-matrix.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ parameters:
3131
container: azureLinux30Amd64
3232
helixTargetContainer: $(helixTargetContainerPrefix)ubuntu-24.04-helix-amd64
3333
osProperties: /p:OSName=linux /p:BuildSdkDeb=true
34-
runTests: true
3534
# Helix is hanging on this job using the container. See: https://github.com/dotnet/dnceng/issues/6000
3635
disableJob: true
3736
- categoryName: TemplateEngine

0 commit comments

Comments
 (0)