Skip to content

Commit

Permalink
build(pipeline caching): Add pipeline package caching for nuget and l…
Browse files Browse the repository at this point in the history
…ibman (#788)

* build(pipeline): Added NuGet package caching

Add CacheBeta task to azure-pipelines.yml to enable NuGet package caching
and hopefully speed up CI builds.
Enable creation of packages.lock.json for projects built in pipeline to
enable above.

* build(pipeline): Added NuGet cache tasks to other stages

* build(pipeline): Added LibMan caching

* build(pipeline): Fixed "pipeline[s]" typos

* build(csproj): Generated packages.lock.json

* build(cache): Fixed libman cache key

* build(cache): Fixed cache step not using template

* build(cache): Changed libman cache key

* build(pipeline): Fixed cache template path in prepare-integration-test-steps.yml

* pipeline(cache): Made NuGet cache unique per OS

* build(nuget): Workaround for failed restore

May be encountering this issue:
microsoft/azure-pipelines-tasks#11449
Suggested workarounds taken from this comment:
NuGet/Home#7921 (comment)

* build(cache): Added OS-specific libman cache paths

* build(pipeline): Moved variables to main yml file

* Remove RestorePackagesWithLockFile from csproj's because that is handles by Directory.Build.Props

* Remove RestoreLockedMode from Directory.Build.Props because you want to be able to update the package lock files as a developer

* Delete not needed nuget.config files

* Regenerate package lock files

* Set restore locked mode true on azure pipelines

* Never RestoreLockedMode for integration test projects because they are used in an integrationtest scenario

* Only use nuget package folders if they contain an entry for our OS, otherwise try deploying embedded vstest binaries

* Remove zero check on _vstestPaths

* Check if paths exists

* ! <> !!

* Install dotnet core before running unit tests

* fix sonarqube major issue

* Update package lock with McMaster.Extensions.CommandLineUtils 2.4.3

* switch back unit test run step

* populate cache before running unit tests

* Revert "populate cache before running unit tests"

This reverts commit a9c5923.

* restore caches as first steps everywhere
  • Loading branch information
Mobrockers authored Nov 4, 2019
1 parent 5642d52 commit 98b16dd
Show file tree
Hide file tree
Showing 15 changed files with 7,601 additions and 34 deletions.
9 changes: 8 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ variables:
MygetFeed: https://www.myget.org/F/stryker-mutator-integrationtest
AzureArtifactFeedUri: https://pkgs.dev.azure.com/stryker-mutator/Stryker/_packaging/stryker-net/nuget/v3/index.json
MygetFeedUri: https://www.myget.org/F/stryker-mutator-integrationtest/api/v3/index.json
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
LibManCacheWindows: $(USERPROFILE)/.librarymanager/cache
LibManCacheMacLinux: $(HOME)/.librarymanager/cache
RestoreLockedMode: true

stages:
- stage: Analysis
Expand All @@ -44,6 +48,7 @@ stages:
pool:
vmImage: 'windows-latest'
steps:
- template: pipeline-templates/populate-cache-steps.yml
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud stryker-net'
Expand Down Expand Up @@ -82,6 +87,7 @@ stages:
deploy:
steps:
- checkout: self
- template: pipeline-templates/populate-cache-steps.yml
- task: DotNetCoreCLI@2
displayName: 'Restore vstest binaries'
inputs:
Expand Down Expand Up @@ -192,6 +198,7 @@ stages:
pool:
vmImage: 'windows-latest'
steps:
- template: pipeline-templates/populate-cache-steps.yml
- task: DotNetCoreCLI@2
displayName: 'Restore vstest binaries'
inputs:
Expand All @@ -207,7 +214,6 @@ stages:
versionEnvVar: PreviewVersion
packagesToPack: $(ProjectsToPack)
packDirectory: $(Build.ArtifactStagingDirectory)/preview

- script: echo "##vso[build.addbuildtag]preview"
displayName: "Tag build as preview build so release gets triggered"
- task: PublishBuildArtifacts@1
Expand All @@ -228,6 +234,7 @@ stages:
pool:
vmImage: 'windows-latest'
steps:
- template: pipeline-templates/populate-cache-steps.yml
- task: DotNetCoreCLI@2
displayName: 'Restore vstest binaries'
inputs:
Expand Down
8 changes: 7 additions & 1 deletion integrationtest/TargetProjects/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
<BuildDirectory>$(RootDirectory)BuildFiles\</BuildDirectory>
</PropertyGroup>

</Project>
<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<RestoreLockedMode>false</RestoreLockedMode>
</PropertyGroup>

</Project>
6 changes: 6 additions & 0 deletions integrationtest/TargetProjects/Library/packages.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 1,
"dependencies": {
".NETCoreApp,Version=v3.0": {}
}
}
Loading

0 comments on commit 98b16dd

Please sign in to comment.