Skip to content

Commit 6d4656d

Browse files
authored
[ci] Internal build: build packages, and workload nugets only once (#5417)
* [ci] Run tests with the final packages on internal pipeline * [tests] Track changes in the packages available in `artifacts` when .. installing the workload for testing.
1 parent 5be752f commit 6d4656d

File tree

2 files changed

+42
-31
lines changed

2 files changed

+42
-31
lines changed

eng/pipelines/templates/BuildAndTest.yml

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,41 @@ 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 pipeline: Build with pack+sign+archive
25+
- ${{ if ne(parameters.runAsPublic, '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 pipeline - helix tests
38+
- ${{ if eq(parameters.runAsPublic, 'true') }}:
39+
- script: ${{ parameters.buildScript }}
40+
-restore -build
41+
-configuration ${{ parameters.buildConfig }}
42+
-pack
43+
/p:ArchiveTests=${{ lower(eq(parameters.runHelixTests, 'true')) }}
44+
/bl:${{ parameters.repoLogPath }}/build.binlog
45+
$(_OfficialBuildIdArgs)
46+
displayName: Build
47+
48+
# Run on windows, either for internal pipeline, or for public+non-helix-tests job
49+
- ${{ if and(eq(parameters.isWindows, 'true'), or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true'))) }}:
50+
- script: ${{ parameters.buildScript }}
51+
-restore -build
52+
-sign $(_SignArgs)
53+
-publish $(_PublishArgs)
54+
-configuration $(_BuildConfig)
55+
/bl:${{ parameters.repoLogPath }}/build-workloads.binlog
56+
-projects eng\workloads\workloads.csproj
57+
$(_InternalBuildArgs)
58+
displayName: Build Workloads
3259

3360
- ${{ if or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true')) }}:
3461
- ${{ if ne(parameters.isWindows, 'true') }}:
@@ -124,27 +151,6 @@ steps:
124151

125152
# Run on windows, for internal pipeline, or public+non-helix-tests job
126153
- ${{ 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-
148154
- ${{ if eq(parameters.runAsPublic, 'true') }}:
149155
- task: PublishPipelineArtifact@1
150156
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)