Pester icon indicating copy to clipboard operation
Pester copied to clipboard

Cache nuget packages in CI-pipeline

Open fflaten opened this issue 3 years ago • 3 comments

Checklist

What is the issue?

Azure Pipeline CI takes forever to restore and build c# projects. 1-1.5min on restoring the empty PesterTests-project itself. Ex.

Microsoft (R) Build Engine version 16.11.3+5d7fe36cf for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored D:\a\1\s\src\csharp\Pester\Pester.csproj **(in 35.09 sec).**
  Restored D:\a\1\s\src\csharp\PesterTests\PesterTests.csproj **(in 1.5 min).**
  Pester -> D:\a\1\s\src\csharp\Pester\bin\Release\net452\Pester.dll
  Pester -> D:\a\1\s\src\csharp\Pester\bin\Release\netstandard2.0\Pester.dll
  PesterTests -> D:\a\1\s\src\csharp\PesterTests\bin\Release\netcoreapp3.1\PesterTests.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:01:55.37

Expected Behavior

Build in CI-pipeline goes faster

Steps To Reproduce

No response

Describe your environment

No response

Possible Solution?

Add caching-steps, see. https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/caching-nuget?view=azure-devops

Will have to add lock-file AFAIK

fflaten avatar Jun 28 '22 16:06 fflaten

Interesting, is that on any CI or just macos? I remember seeing it on macos a lot. The tests project does not use anything special, I don't see why that would take 1.5 minutes to restore.

 dotnet restore "S:\p\pester\src\csharp\Pester.sln" --force-evaluate --no-cache --force
  Determining projects to restore...
  Restored S:\p\pester\src\csharp\Pester\Pester.csproj (in 157 ms).
  Restored S:\p\pester\src\csharp\PesterTests\PesterTests.csproj (in 202 ms).

nohwnd avatar Jun 30 '22 08:06 nohwnd

It was pester CI, build step on windows_2019. Check a PR :) it's been slower lately, but still a minute ++ we don't need for mostly static dependencies.

fflaten avatar Jun 30 '22 11:06 fflaten

The PesterTests-project itself could also be deleted until until someone actually wants to write the tests. Most is probably covered through the PowerShell tests.

fflaten avatar Jun 30 '22 15:06 fflaten