Skip to content

Commit f0f5031

Browse files
committed
[ci] For internal pipeline, build packages only once
Build packages only once, and then use those packages for running all the tests. This would make sure that we ship the packages that tests were run against. Details about how this was hit is in the referenced issue. Fixes #5404 .
1 parent 2ea9817 commit f0f5031

File tree

2 files changed

+40
-31
lines changed

2 files changed

+40
-31
lines changed

eng/pipelines/templates/BuildAndTest.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,39 @@ parameters:
2121
default: false
2222

2323
steps:
24-
- script: ${{ parameters.buildScript }}
25-
-restore -build
26-
-pack
27-
-configuration ${{ parameters.buildConfig }}
28-
/p:ArchiveTests=true
29-
/bl:${{ parameters.repoLogPath }}/build.binlog
30-
$(_OfficialBuildIdArgs)
31-
displayName: Build
24+
# Internal/helix-tests - Build with pack+sign+archive only for internal pipeline or when running helix tests
25+
- ${{ if or(ne(parameters.runAsPublic, 'true'), eq(parameters.runHelixTests, 'true')) }}:
26+
- script: ${{ parameters.buildScript }}
27+
-restore -build
28+
-pack
29+
-sign $(_SignArgs)
30+
-publish $(_PublishArgs)
31+
-configuration ${{ parameters.buildConfig }}
32+
/p:ArchiveTests=true
33+
/bl:${{ parameters.repoLogPath }}/build.binlog
34+
$(_OfficialBuildIdArgs)
35+
displayName: Build
36+
37+
# Public or non-helix tests
38+
- ${{ else }}:
39+
- script: ${{ parameters.buildScript }}
40+
-restore -build
41+
-configuration ${{ parameters.buildConfig }}
42+
/bl:${{ parameters.repoLogPath }}/build.binlog
43+
$(_OfficialBuildIdArgs)
44+
displayName: Build
45+
46+
# Run on windows, for internal pipeline, or public+non-helix-tests job
47+
- ${{ if and(eq(parameters.isWindows, 'true'), or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true'))) }}:
48+
- script: ${{ parameters.buildScript }}
49+
-restore -build
50+
-sign $(_SignArgs)
51+
-publish $(_PublishArgs)
52+
-configuration $(_BuildConfig)
53+
/bl:${{ parameters.repoLogPath }}/build-workloads.binlog
54+
-projects eng\workloads\workloads.csproj
55+
$(_InternalBuildArgs)
56+
displayName: Build Workloads
3257

3358
- ${{ if or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true')) }}:
3459
- ${{ if ne(parameters.isWindows, 'true') }}:
@@ -124,27 +149,6 @@ steps:
124149

125150
# Run on windows, for internal pipeline, or public+non-helix-tests job
126151
- ${{ if and(eq(parameters.isWindows, 'true'), or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true'))) }}:
127-
- script: ${{ parameters.buildScript }}
128-
-pack
129-
-sign $(_SignArgs)
130-
-publish $(_PublishArgs)
131-
-configuration ${{ parameters.buildConfig }}
132-
/bl:${{ parameters.repoLogPath }}/pack.binlog
133-
/p:Restore=false /p:Build=false
134-
$(_OfficialBuildIdArgs)
135-
displayName: Pack, Sign, and Publish
136-
137-
- script: ${{ parameters.buildScript }}
138-
-restore -build
139-
-pack
140-
-sign $(_SignArgs)
141-
-publish $(_PublishArgs)
142-
-configuration $(_BuildConfig)
143-
/bl:${{ parameters.repoLogPath }}/build-workloads.binlog
144-
-projects eng\workloads\workloads.csproj
145-
$(_InternalBuildArgs)
146-
displayName: Build Workloads
147-
148152
- ${{ if eq(parameters.runAsPublic, 'true') }}:
149153
- task: PublishPipelineArtifact@1
150154
displayName: Publish VSDrop MSIs

tests/Shared/Aspire.Workload.Testing.targets

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,15 @@
111111
<UnexpectedPackages Include="@(AllPackages)" Exclude="@(ExpectedPackagePaths)" />
112112

113113
<!-- Ignore these packages which are part of the workload. Existence of these would get checked
114-
by the workload installation targets. And their names don't correspond to project names. -->
114+
by the workload installation targets. -->
115+
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Hosting.Sdk.'))" />
116+
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.ProjectTemplates.'))" />
115117
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Microsoft.NET.Sdk.Aspire.Manifest-'))" />
116-
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Hosting.Orchestration.'))" />
118+
119+
<!-- Exclude the packages with arch-specific nugets -->
117120
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Dashboard.Sdk.'))" />
121+
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Hosting.Orchestration.'))" />
122+
118123
</ItemGroup>
119124

120125
<Warning Text="Found some unexpected packages in '$(ArtifactsShippingPackagesDir)', which might mean that the list of expected packages is incorrect: @(UnexpectedPackages -> '%(FileName)%(Extension)', ', '). Use %24(SkipPackageCheckForWorkloadTesting)='true' to skip this."

0 commit comments

Comments
 (0)