From a146f6d22350204efa98689b5e286dcc32156bd3 Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 11 May 2021 21:56:26 +0100 Subject: [PATCH] Cache nuget packages --- azure-pipelines.yml | 29 ++++++--- src/Directory.Build.props | 15 ++--- src/Directory.Packages.props | 61 +++++++++++++++++++ src/NzbDrone.Api.Test/Readarr.Api.Test.csproj | 2 +- .../Readarr.Automation.Test.csproj | 4 +- src/NzbDrone.Common/Readarr.Common.csproj | 32 +++++----- .../Readarr.Core.Test.csproj | 8 +-- src/NzbDrone.Core/Readarr.Core.csproj | 40 ++++++------ src/NzbDrone.Host/Readarr.Host.csproj | 6 +- .../Readarr.Integration.Test.csproj | 2 +- .../Readarr.Mono.Test.csproj | 2 +- src/NzbDrone.Mono/Readarr.Mono.csproj | 6 +- .../Readarr.Test.Common.csproj | 20 +++--- src/NzbDrone.Update/Readarr.Update.csproj | 6 +- src/NzbDrone.Windows/Readarr.Windows.csproj | 4 +- src/NzbDrone/Readarr.csproj | 2 +- src/Readarr.Api.V1/Readarr.Api.V1.csproj | 10 +-- src/Readarr.Http/Readarr.Http.csproj | 6 +- .../ServiceInstall/ServiceInstall.csproj | 2 +- .../ServiceUninstall/ServiceUninstall.csproj | 2 +- 20 files changed, 168 insertions(+), 91 deletions(-) create mode 100644 src/Directory.Packages.props diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2a5cf6200..b69bded37 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,6 +15,7 @@ variables: sentryUrl: 'https://sentry.servarr.com' dotnetVersion: '5.0.201' yarnCacheFolder: $(Pipeline.Workspace)/.yarn + nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages trigger: branches: @@ -93,15 +94,18 @@ stages: sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' $BUNDLEDVERSIONS fi displayName: Enable FreeBSD Support + - task: Cache@2 + inputs: + key: 'nuget | "$(Agent.OS)" | $(Build.SourcesDirectory)/src/Directory.Packages.props' + restoreKeys: | + nuget | "$(Agent.OS)" + nuget + path: $(nugetCacheFolder) + displayName: Cache NuGet packages - bash: ./build.sh --backend --enable-bsd displayName: Build Readarr Backend - - bash: | - find ${OUTPUTFOLDER} -type f ! -path "*/publish/*" -exec rm -rf {} \; - find ${OUTPUTFOLDER} -depth -empty -type d -exec rm -r "{}" \; - find ${TESTSFOLDER} -type f ! -path "*/publish/*" -exec rm -rf {} \; - find ${TESTSFOLDER} -depth -empty -type d -exec rm -r "{}" \; - displayName: Clean up intermediate output - condition: and(succeeded(), ne(variables['osName'], 'Windows')) + env: + NUGET_PACKAGES: $(nugetCacheFolder) - publish: $(outputFolder) artifact: '$(osName)Backend' displayName: Publish Backend @@ -835,6 +839,15 @@ stages: version: $(dotnetVersion) - checkout: self # Need history for Sonar analysis submodules: true + - task: Cache@2 + inputs: + key: 'nuget | "$(Agent.OS)" | $(Build.SourcesDirectory)/src/Directory.Packages.props' + restoreKeys: | + nuget | "$(Agent.OS)" + nuget + path: $(nugetCacheFolder) + displayName: Cache NuGet packages + - task: SonarCloudPrepare@1 condition: eq(variables['System.PullRequest.IsFork'], 'False') inputs: @@ -853,6 +866,8 @@ stages: ./build.sh --backend -f net5.0 -r linux-x64 TEST_DIR=_tests/net5.0/linux-x64/publish/ ./test.sh Linux Unit Coverage displayName: Coverage Unit Tests + env: + NUGET_PACKAGES: $(nugetCacheFolder) - task: SonarCloudAnalyze@1 condition: eq(variables['System.PullRequest.IsFork'], 'False') displayName: Publish SonarCloud Results diff --git a/src/Directory.Build.props b/src/Directory.Build.props index a76fc5eeb..23abe5530 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,6 +2,7 @@ true + true AnyCPU true @@ -42,7 +43,7 @@ $(ReadarrRootDir)_output\Readarr.Update\ - false + false $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(BaseIntermediateOutputPath)')) $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)')) $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(OutputPath)')) @@ -89,17 +90,17 @@ - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props new file mode 100644 index 000000000..e6abce960 --- /dev/null +++ b/src/Directory.Packages.props @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NzbDrone.Api.Test/Readarr.Api.Test.csproj b/src/NzbDrone.Api.Test/Readarr.Api.Test.csproj index 492e03164..383748859 100644 --- a/src/NzbDrone.Api.Test/Readarr.Api.Test.csproj +++ b/src/NzbDrone.Api.Test/Readarr.Api.Test.csproj @@ -3,7 +3,7 @@ net5.0 - + diff --git a/src/NzbDrone.Automation.Test/Readarr.Automation.Test.csproj b/src/NzbDrone.Automation.Test/Readarr.Automation.Test.csproj index 2a2eb7359..fdfebb896 100644 --- a/src/NzbDrone.Automation.Test/Readarr.Automation.Test.csproj +++ b/src/NzbDrone.Automation.Test/Readarr.Automation.Test.csproj @@ -3,8 +3,8 @@ net5.0 - - + + diff --git a/src/NzbDrone.Common/Readarr.Common.csproj b/src/NzbDrone.Common/Readarr.Common.csproj index 2077e2635..e9c1e961d 100644 --- a/src/NzbDrone.Common/Readarr.Common.csproj +++ b/src/NzbDrone.Common/Readarr.Common.csproj @@ -5,22 +5,22 @@ ISMUSL - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/NzbDrone.Core.Test/Readarr.Core.Test.csproj b/src/NzbDrone.Core.Test/Readarr.Core.Test.csproj index 30084d035..a6ea23f94 100644 --- a/src/NzbDrone.Core.Test/Readarr.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/Readarr.Core.Test.csproj @@ -3,10 +3,10 @@ net5.0 - - - - + + + + diff --git a/src/NzbDrone.Core/Readarr.Core.csproj b/src/NzbDrone.Core/Readarr.Core.csproj index 5c1c78057..c2a0709ab 100644 --- a/src/NzbDrone.Core/Readarr.Core.csproj +++ b/src/NzbDrone.Core/Readarr.Core.csproj @@ -3,26 +3,26 @@ net5.0 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/NzbDrone.Host/Readarr.Host.csproj b/src/NzbDrone.Host/Readarr.Host.csproj index 590778746..05e0fdf20 100644 --- a/src/NzbDrone.Host/Readarr.Host.csproj +++ b/src/NzbDrone.Host/Readarr.Host.csproj @@ -4,9 +4,9 @@ Library - - - + + + diff --git a/src/NzbDrone.Integration.Test/Readarr.Integration.Test.csproj b/src/NzbDrone.Integration.Test/Readarr.Integration.Test.csproj index c089ba0a5..64dfa513a 100644 --- a/src/NzbDrone.Integration.Test/Readarr.Integration.Test.csproj +++ b/src/NzbDrone.Integration.Test/Readarr.Integration.Test.csproj @@ -4,7 +4,7 @@ Library - + diff --git a/src/NzbDrone.Mono.Test/Readarr.Mono.Test.csproj b/src/NzbDrone.Mono.Test/Readarr.Mono.Test.csproj index 552b9f298..f5dcb7da2 100644 --- a/src/NzbDrone.Mono.Test/Readarr.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/Readarr.Mono.Test.csproj @@ -3,7 +3,7 @@ net5.0 - + diff --git a/src/NzbDrone.Mono/Readarr.Mono.csproj b/src/NzbDrone.Mono/Readarr.Mono.csproj index d04f03537..70792eea6 100644 --- a/src/NzbDrone.Mono/Readarr.Mono.csproj +++ b/src/NzbDrone.Mono/Readarr.Mono.csproj @@ -3,9 +3,9 @@ net5.0 - - - + + + diff --git a/src/NzbDrone.Test.Common/Readarr.Test.Common.csproj b/src/NzbDrone.Test.Common/Readarr.Test.Common.csproj index 0f41a4320..beaa04ee0 100644 --- a/src/NzbDrone.Test.Common/Readarr.Test.Common.csproj +++ b/src/NzbDrone.Test.Common/Readarr.Test.Common.csproj @@ -3,16 +3,16 @@ net5.0 - - - - - - - - - - + + + + + + + + + + diff --git a/src/NzbDrone.Update/Readarr.Update.csproj b/src/NzbDrone.Update/Readarr.Update.csproj index a22a06001..b72811e43 100644 --- a/src/NzbDrone.Update/Readarr.Update.csproj +++ b/src/NzbDrone.Update/Readarr.Update.csproj @@ -4,9 +4,9 @@ net5.0 - - - + + + diff --git a/src/NzbDrone.Windows/Readarr.Windows.csproj b/src/NzbDrone.Windows/Readarr.Windows.csproj index 2cb45c52a..668d39198 100644 --- a/src/NzbDrone.Windows/Readarr.Windows.csproj +++ b/src/NzbDrone.Windows/Readarr.Windows.csproj @@ -3,8 +3,8 @@ net5.0 - - + + diff --git a/src/NzbDrone/Readarr.csproj b/src/NzbDrone/Readarr.csproj index d312a13be..141ee92bc 100644 --- a/src/NzbDrone/Readarr.csproj +++ b/src/NzbDrone/Readarr.csproj @@ -9,7 +9,7 @@ true - + diff --git a/src/Readarr.Api.V1/Readarr.Api.V1.csproj b/src/Readarr.Api.V1/Readarr.Api.V1.csproj index 9807a1ba3..3135b72ab 100644 --- a/src/Readarr.Api.V1/Readarr.Api.V1.csproj +++ b/src/Readarr.Api.V1/Readarr.Api.V1.csproj @@ -9,10 +9,10 @@ - - - - - + + + + + diff --git a/src/Readarr.Http/Readarr.Http.csproj b/src/Readarr.Http/Readarr.Http.csproj index e2ae24478..07f12c7bc 100644 --- a/src/Readarr.Http/Readarr.Http.csproj +++ b/src/Readarr.Http/Readarr.Http.csproj @@ -3,9 +3,9 @@ net5.0 - - - + + + diff --git a/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj index 35cf3158e..b614418b0 100644 --- a/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj +++ b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj @@ -4,6 +4,6 @@ net5.0 - + diff --git a/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj index bf8a85b7b..96ac3a011 100644 --- a/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj +++ b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj @@ -4,6 +4,6 @@ net5.0 - +