From dc8a8e6371e7654536d561c21fe6dc9d174e927d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 6 Mar 2018 18:33:18 +0100 Subject: [PATCH] Speed up AppVeyor build times * Examples are no longer built for all images * Coverage is no longer collected from every build * The number of configurations is reduced --- appveyor.yml | 41 ++++++++++++++++++++--- misc/appveyorBuildConfigurationScript.bat | 30 ++++++++++++----- misc/appveyorTestRunScript.bat | 10 ++++-- misc/installOpenCppCoverage.ps1 | 2 +- 4 files changed, 67 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2d681726..847d3f62 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,18 +19,51 @@ environment: - additional_flags: "/D_UNICODE /DUNICODE" wmain: 1 + coverage: 0 + + # Have a coverage dimension + - additional_flags: "" + wmain: 0 + coverage: 1 + + # Have an examples dimension + - additional_flags: "" + wmain: 0 + examples: 1 + matrix: exclude: - os: Visual Studio 2015 additional_flags: "/permissive- /std:c++latest" -init: - - git config --global core.autocrlf input + - os: Visual Studio 2015 + additional_flags: "/D_UNICODE /DUNICODE" + + # Exclude unwanted coverage configurations + - coverage: 1 + platform: Win32 + + - coverage: 1 + os: Visual Studio 2015 + + - coverage: 1 + configuration: Release + + # Exclude unwanted examples configurations + - examples: 1 + platform: Win32 + + - examples: 1 + os: Visual Studio 2015 + + - examples: 1 + configuration: Release + install: - - ps: if (($env:CONFIGURATION) -eq "Debug" ) { python -m pip install codecov } - - ps: if (($env:CONFIGURATION) -eq "Debug" ) { .\misc\installOpenCppCoverage.ps1 } + - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { python -m pip install codecov } + - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\misc\installOpenCppCoverage.ps1 } # Win32 and x64 are CMake-compatible solution platform names. # This allows us to pass %PLATFORM% to CMake -A. diff --git a/misc/appveyorBuildConfigurationScript.bat b/misc/appveyorBuildConfigurationScript.bat index 27efcd10..1e91a588 100644 --- a/misc/appveyorBuildConfigurationScript.bat +++ b/misc/appveyorBuildConfigurationScript.bat @@ -1,12 +1,26 @@ -@REM # In debug build, we want to -@REM # 1) Prebuild memcheck redirecter -@REM # 2) Regenerate single header include for examples -@REM # 3) Enable building examples + +@REM # Possibilities: +@REM # Debug build + coverage +@REM # Debug build + examples +@REM # Debug build + --- +@REM # Release build if "%CONFIGURATION%"=="Debug" ( - python scripts\generateSingleHeader.py - cmake -Hmisc -Bbuild-misc -A%PLATFORM% - cmake --build build-misc - cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=ON -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind + if "%coverage%"=="1" ( + @REM # coverage needs to build the special helper as well as the main + cmake -Hmisc -Bbuild-misc -A%PLATFORM% + cmake --build build-misc + cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind + ) else ( + @REM # We know that coverage is 0 + if "%examples%"=="1" ( + @REM # Examples live off the single header, so it needs to be regenerated + python scripts\generateSingleHeader.py + cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=ON + ) else ( + @REM # This is just a plain debug build + cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% + ) + ) ) if "%CONFIGURATION%"=="Release" ( cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% diff --git a/misc/appveyorTestRunScript.bat b/misc/appveyorTestRunScript.bat index fdcc2ce0..19a364be 100644 --- a/misc/appveyorTestRunScript.bat +++ b/misc/appveyorTestRunScript.bat @@ -1,8 +1,12 @@ cd Build if "%CONFIGURATION%"=="Debug" ( - ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck - python ..\misc\appveyorMergeCoverageScript.py - codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% + if "%coverage%"=="1" ( + ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck + python ..\misc\appveyorMergeCoverageScript.py + codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% + ) else ( + ctest -j 2 -C %CONFIGURATION% + ) ) if "%CONFIGURATION%"=="Release" ( ctest -j 2 -C %CONFIGURATION% diff --git a/misc/installOpenCppCoverage.ps1 b/misc/installOpenCppCoverage.ps1 index 9dbffca7..b0e00306 100644 --- a/misc/installOpenCppCoverage.ps1 +++ b/misc/installOpenCppCoverage.ps1 @@ -1,5 +1,5 @@ # Downloads are done from the oficial github release page links -$downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.6.1/OpenCppCoverageSetup-x64-0.9.6.1.exe" +$downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.7.0/OpenCppCoverageSetup-x64-0.9.7.0.exe" $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe") if(-Not (Test-Path $installerPath)) {