From 2ec3056f9ea19dd20933c471ec7a0d2e01911761 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Tue, 5 Jun 2018 17:48:44 +0000 Subject: [PATCH] Use Appveyor matrix for faster PR builds (#6945) Related: #6944 Reduce PR build time by 5 minutes by: Having Packaging as a separate build job in a matrix -> runs in parallel in PR builds because the Microsoft account is a paid account that allows that (at no additional costs) Not caching the dotnet folder anymore, which is too large and the overhead of zipping/unzipping/upload/download does not pay off (and fails in forked builds that are on a free AppVeyor account due to the size). Setting the environment variable DOTNET_SKIP_FIRST_TIME_EXPERIENCE to 1 because the initialization of the dotnet CLI cache (1 minute) does not pay off for the whole build. The total build time of builds on a fork that is on a free AppVeyor account and therefore does not have parallelism, remains the same due to the time saving of redundant caching. This is just a simple example of what we can easily achieve, we could continue this pattern and split the test runs as per the referenced issue to bring PR builds down to 10 minutes (but this will incur an increase for fork builds on free AppVeyor accounts) --- appveyor.yml | 26 ++++++++++++++++---------- tools/appveyor.psm1 | 6 ------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9c79aa54c1..4ab026f2c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,33 +1,39 @@ # version is set in tools\appveyor.psm1 - Invoke-AppVeyorInstall +environment: + POWERSHELL_TELEMETRY_OPTOUT: 1 + # Avoid expensive initialization of dotnet cli, see: http://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + Purpose: BuildingAndPackaging + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + Purpose: BuildingAndTesting -image: Visual Studio 2017 +# Stop all jobs in the matrix if any one them fail +matrix: + fast_finish: true # cache version - netcoreapp.2.1-sdk.2.1.300 cache: - - '%LocalAppData%\Microsoft\dotnet -> appveyor.yml' - '%HOMEDRIVE%%HOMEPATH%\.nuget\packages -> appveyor.yml' nuget: project_feed: true -environment: - POWERSHELL_TELEMETRY_OPTOUT: 1 - install: - git submodule update --init - ps: Import-Module .\tools\Appveyor.psm1 - ps: Invoke-AppveyorInstall build_script: - - ps: Invoke-AppveyorBuild + - ps: if ($env:Purpose -eq 'BuildingAndTesting'){ Invoke-AppveyorBuild } test_script: - - ps: Invoke-AppveyorTest + - ps: if ($env:Purpose -eq 'BuildingAndTesting'){ Invoke-AppveyorTest } after_test: - - ps: Invoke-AppVeyorAfterTest + - ps: if ($env:Purpose -eq 'BuildingAndTesting'){ Invoke-AppVeyorAfterTest } # Run the finish command and delete files which should not be in the cache on_finish: - - ps: Invoke-AppveyorFinish - - ps: Invoke-AppVeyorCleanCache + - ps: if ($env:Purpose -eq 'BuildingAndPackaging'){ Invoke-AppveyorFinish } diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index ff0a3cd4db..483e843307 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -551,9 +551,3 @@ function Invoke-AppveyorFinish throw $_ } } - -# Clean the Cache of files which should not be cached -function Invoke-AppVeyorCleanCache -{ - Remove-Item $env:LocalAppData\Microsoft\dotnet\optimizationdata -Recurse -force -}