add verbose to windows builds and use 4 parallel jobs (#1183)

* add verbose to windows build and use 4 parallel jobs
This commit is contained in:
Victor Vazquez 2020-12-15 22:54:49 +00:00 committed by GitHub
parent fc7d52926a
commit 5e7dc42df8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View File

@ -95,6 +95,13 @@ cmake ..
cmake --build .
```
#### Static Analysis
When the project is built using MSVC on Windows, the compiler can run [static analysis](https://docs.microsoft.com/cpp/code-quality/walkthrough-analyzing-c-cpp-code-for-defects) on the code. The CMake project can add the required compiler flags to perform this check. To enable this feature, set an environment variable `AZURE_ENABLE_STATIC_ANALYSIS`.
Keep in mind that enabling static analysis will significantly impact build time. It is recommended to run it right before submitting the PR, but not in your inner developer loop.
The static code analysis is `ON` for the CI pipelines. You can turn this feature `ON` locally to debug errors reported during CI or for the last time you build and test before creating a new PR.
#### CMake build options
The following CMake options are available for adding/removing project features.

View File

@ -12,7 +12,13 @@ if(MSVC)
string(REGEX REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#https://stackoverflow.com/questions/37527946/warning-unreferenced-inline-function-has-been-removed
add_compile_options(/W4 ${WARNINGS_AS_ERRORS_FLAG} /wd5031 /wd4668 /wd4820 /wd4255 /wd4710 /analyze)
add_compile_options(/W4 ${WARNINGS_AS_ERRORS_FLAG} /wd5031 /wd4668 /wd4820 /wd4255 /wd4710)
# NOTE: Static analysis will slow building time considerably and it is run during CI gates.
# It is better to turn in on to debug errors reported by CI than have it ON all the time.
if (DEFINED ENV{AZURE_ENABLE_STATIC_ANALYSIS})
add_compile_options(/analyze)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "-Werror")

View File

@ -37,12 +37,14 @@ jobs:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: Win32
CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON' #Leaving curl on here to explicitly test what the default behavior is on windows.
BuildArgs: '-v --parallel 8'
Win_x64:
OSVmImage: 'windows-2019'
VcpkgInstall: 'curl[winssl] libxml2 nlohmann-json'
VCPKG_DEFAULT_TRIPLET: 'x64-windows-static'
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: x64
BuildArgs: '-v --parallel 8'
MacOS_x64:
OSVmImage: 'macOS-10.14'
VcpkgInstall: 'curl[ssl] libxml2 openssl nlohmann-json'
@ -66,6 +68,7 @@ jobs:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: Win32
CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DBUILD_TRANSPORT_WINHTTP=ON'
BuildArgs: '-v --parallel 8'
Win_x64_with_unit_test:
OSVmImage: 'windows-2019'
VcpkgInstall: 'curl[winssl] libxml2 nlohmann-json'
@ -73,6 +76,7 @@ jobs:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: x64
CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DBUILD_TRANSPORT_WINHTTP=ON'
BuildArgs: '-v --parallel 8'
MacOS_x64_with_unit_test:
OSVmImage: 'macOS-10.14'
VcpkgInstall: 'curl[ssl] libxml2 openssl nlohmann-json'
@ -84,6 +88,7 @@ jobs:
CMOCKA_XML_FILE: "%g-test-results.xml"
CMOCKA_MESSAGE_OUTPUT: "xml"
BuildArgs: ""
AZURE_ENABLE_STATIC_ANALYSIS: 1
steps:
- checkout: self

View File

@ -39,6 +39,7 @@ jobs:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: Win32
CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON'
BuildArgs: '-v --parallel 8'
Win_x64_with_unit_test:
OSVmImage: 'windows-2019'
VcpkgInstall: 'curl[winssl] libxml2 nlohmann-json'
@ -46,6 +47,7 @@ jobs:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: x64
CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON'
BuildArgs: '-v --parallel 8'
MacOS_x64_with_unit_test:
OSVmImage: 'macOS-10.14'
VcpkgInstall: 'curl[ssl] libxml2 openssl nlohmann-json'
@ -56,6 +58,7 @@ jobs:
variables:
CMOCKA_XML_FILE: "%g-test-results.xml"
CMOCKA_MESSAGE_OUTPUT: "xml"
AZURE_ENABLE_STATIC_ANALYSIS: 1
steps:
- checkout: self
@ -111,4 +114,4 @@ jobs:
- template: /eng/common/TestResources/remove-test-resources.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }}
SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }}