Skip to content

Commit

Permalink
[ci] For internal pipeline, build packages only once
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
radical committed Aug 28, 2024
1 parent 2ea9817 commit f0f5031
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 31 deletions.
62 changes: 33 additions & 29 deletions eng/pipelines/templates/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,39 @@ parameters:
default: false

steps:
- script: ${{ parameters.buildScript }}
-restore -build
-pack
-configuration ${{ parameters.buildConfig }}
/p:ArchiveTests=true
/bl:${{ parameters.repoLogPath }}/build.binlog
$(_OfficialBuildIdArgs)
displayName: Build
# Internal/helix-tests - Build with pack+sign+archive only for internal pipeline or when running helix tests
- ${{ if or(ne(parameters.runAsPublic, 'true'), eq(parameters.runHelixTests, 'true')) }}:
- script: ${{ parameters.buildScript }}
-restore -build
-pack
-sign $(_SignArgs)
-publish $(_PublishArgs)
-configuration ${{ parameters.buildConfig }}
/p:ArchiveTests=true
/bl:${{ parameters.repoLogPath }}/build.binlog
$(_OfficialBuildIdArgs)
displayName: Build

# Public or non-helix tests
- ${{ else }}:
- script: ${{ parameters.buildScript }}
-restore -build
-configuration ${{ parameters.buildConfig }}
/bl:${{ parameters.repoLogPath }}/build.binlog
$(_OfficialBuildIdArgs)
displayName: Build

# Run on windows, for internal pipeline, or public+non-helix-tests job
- ${{ if and(eq(parameters.isWindows, 'true'), or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true'))) }}:
- script: ${{ parameters.buildScript }}
-restore -build
-sign $(_SignArgs)
-publish $(_PublishArgs)
-configuration $(_BuildConfig)
/bl:${{ parameters.repoLogPath }}/build-workloads.binlog
-projects eng\workloads\workloads.csproj
$(_InternalBuildArgs)
displayName: Build Workloads

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

# Run on windows, for internal pipeline, or public+non-helix-tests job
- ${{ if and(eq(parameters.isWindows, 'true'), or(ne(parameters.runAsPublic, 'true'), ne(parameters.runHelixTests, 'true'))) }}:
- script: ${{ parameters.buildScript }}
-pack
-sign $(_SignArgs)
-publish $(_PublishArgs)
-configuration ${{ parameters.buildConfig }}
/bl:${{ parameters.repoLogPath }}/pack.binlog
/p:Restore=false /p:Build=false
$(_OfficialBuildIdArgs)
displayName: Pack, Sign, and Publish

- script: ${{ parameters.buildScript }}
-restore -build
-pack
-sign $(_SignArgs)
-publish $(_PublishArgs)
-configuration $(_BuildConfig)
/bl:${{ parameters.repoLogPath }}/build-workloads.binlog
-projects eng\workloads\workloads.csproj
$(_InternalBuildArgs)
displayName: Build Workloads

- ${{ if eq(parameters.runAsPublic, 'true') }}:
- task: PublishPipelineArtifact@1
displayName: Publish VSDrop MSIs
Expand Down
9 changes: 7 additions & 2 deletions tests/Shared/Aspire.Workload.Testing.targets
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@
<UnexpectedPackages Include="@(AllPackages)" Exclude="@(ExpectedPackagePaths)" />

<!-- Ignore these packages which are part of the workload. Existence of these would get checked
by the workload installation targets. And their names don't correspond to project names. -->
by the workload installation targets. -->
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Hosting.Sdk.'))" />
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.ProjectTemplates.'))" />
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Microsoft.NET.Sdk.Aspire.Manifest-'))" />
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Hosting.Orchestration.'))" />

<!-- Exclude the packages with arch-specific nugets -->
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Dashboard.Sdk.'))" />
<UnexpectedPackages Remove="@(UnexpectedPackages)" Condition="$([System.String]::Copy('%(UnexpectedPackages.FileName)').StartsWith('Aspire.Hosting.Orchestration.'))" />

</ItemGroup>

<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."
Expand Down

0 comments on commit f0f5031

Please sign in to comment.