Skip to content

Commit

Permalink
Add caching to pipeline (#4098)
Browse files Browse the repository at this point in the history
* bump cake and report gen

* Delete old cake pinning

* Add caching to pipeline

* Fix logger deprecation warning

* Remove unused addin

* Bump gitversion tool
  • Loading branch information
Cheesebaron committed Feb 18, 2021
1 parent 16a46a6 commit dcc8bd1
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "0.38.4",
"version": "1.0.0",
"commands": [
"dotnet-cake"
]
},
"dotnet-reportgenerator-globaltool": {
"version": "4.5.8",
"version": "4.8.5",
"commands": [
"reportgenerator"
]
}
}
}
}
42 changes: 16 additions & 26 deletions azure-pipelines-quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,24 @@ pr:
- '**/*.md'
- docs/*

stages:
- stage: Build
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
NUGET_PACKAGES: '$(Pipeline.Workspace)/.nuget/packages'

jobs:
- job: Build
pool:
vmImage: windows-latest
pool:
vmImage: windows-latest

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.402
steps:
- template: azure-pipelines-shared.yml

- pwsh: |
$jdkPath = $env:JAVA_HOME_11_X64
Write-Host "##vso[task.setvariable variable=JAVA_HOME]$jdkPath"
displayName: "Use JDK11 by default"
- pwsh: |
$jdkPath = $env:JAVA_HOME_11_X64
Write-Host "##vso[task.setvariable variable=JAVA_HOME]$jdkPath"
displayName: "Use JDK11 by default"

- script: dotnet tool restore
displayName: Restore dotnet tools
- script: dotnet tool restore
displayName: Restore dotnet tools

- script: dotnet cake --bootstrap
displayName: Bootstrap cake

- pwsh: dotnet cake --verbosity=Normal --target=Sonar --sonarKey=$env:SONARY_KEY
env:
SONARY_KEY: $(sonarKey)
- pwsh: dotnet cake --verbosity=Normal --target=Sonar --sonarKey=$env:SONARY_KEY
env:
SONARY_KEY: $(sonarKey)
26 changes: 26 additions & 0 deletions azure-pipelines-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.402

- task: Cache@2
displayName: Cache NuGet packages
inputs:
key: 'nuget | "$(Agent.OS)" | Directory.Packages.props'
restoreKeys: |
nuget | "$(Agent.OS)"
nuget
path: '$(NUGET_PACKAGES)'
continueOnError: true

- task: Cache@2
displayName: Cache Cake tools
inputs:
key: '"$(Agent.OS)" | build.cake'
path: 'tools'
continueOnError: true

- script: dotnet tool restore
displayName: Restore dotnet tools
18 changes: 5 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,20 @@ pr:
- '**/*.md'
- docs/*

variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
NUGET_PACKAGES: '$(Pipeline.Workspace)/.nuget/packages'

stages:
- stage: Build
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

jobs:
- job: Build
pool:
vmImage: windows-latest

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.402

- script: dotnet tool restore
displayName: Restore dotnet tools

- script: dotnet cake --bootstrap
displayName: Bootstrap cake
- template: azure-pipelines-shared.yml

- script: dotnet cake --verbosity=Normal --artifactsDir=$(Build.ArtifactStagingDirectory)

Expand Down
5 changes: 2 additions & 3 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#module nuget:?package=Cake.DotNetTool.Module&version=0.4.0
#tool dotnet:n?package=GitVersion.Tool&version=5.3.5
#tool dotnet:n?package=GitVersion.Tool&version=5.6.6
#tool nuget:?package=vswhere&version=2.8.4
#tool nuget:?package=MSBuild.SonarQube.Runner.Tool&version=4.8.0
#addin nuget:?package=Cake.Figlet&version=1.3.1
#addin nuget:?package=Cake.Git&version=0.21.0
#addin nuget:?package=Cake.Sonar&version=1.1.25

var solutionName = "MvvmCross";
Expand Down Expand Up @@ -173,7 +172,7 @@ Task("UnitTest")
{
var projectName = project.GetFilenameWithoutExtension();
var testXml = MakeAbsolute(new FilePath(outputDir + "/Tests/" + projectName + ".xml"));
settings.Logger = $"xunit;LogFilePath={testXml.FullPath}";
settings.Loggers = new string[] { $"xunit;LogFilePath={testXml.FullPath}" };
try
{
DotNetCoreTest(project.ToString(), settings);
Expand Down
4 changes: 0 additions & 4 deletions tools/packages.config

This file was deleted.

0 comments on commit dcc8bd1

Please sign in to comment.