Test Cmake generate configs (#3230)

Adding extra stage for individual packages generation
This commit is contained in:
Victor Vazquez 2022-01-11 15:49:56 -08:00 committed by GitHub
parent 4239100f3b
commit dc5b45e759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 201 additions and 33 deletions

View File

@ -17,26 +17,43 @@ endif()
# On POSIX: Make sure to build Curl either if it was user-requested or no transport was selected at all.
if (WIN32 OR MINGW OR MSYS OR CYGWIN)
if (BUILD_TRANSPORT_CURL)
# Specified by user on CMake input Libcurl
add_compile_definitions(BUILD_CURL_HTTP_TRANSPORT_ADAPTER)
endif()
if (BUILD_TRANSPORT_WINHTTP OR (NOT BUILD_TRANSPORT_CURL AND NOT BUILD_TRANSPORT_CUSTOM))
message("By default, if no option is selected, on Windows, WinHTTP transport adapter is used.")
# WinHTTP selected by user on CMake input
# OR Nothing selected by CMake input (not libcurl or custom). Then set default for Windows.
if (NOT BUILD_TRANSPORT_WINHTTP AND NOT BUILD_TRANSPORT_CUSTOM)
# No custom and No winHTTP.
message("No transport adapter was selected, using WinHTTP as the default option for Windows.")
endif()
add_compile_definitions(BUILD_TRANSPORT_WINHTTP_ADAPTER)
if(AZ_ALL_LIBRARIES)
if (NOT BUILD_TRANSPORT_WINHTTP)
# When user did not provide the input option, we need to turn it ON as it is used to include the src code
SET(BUILD_TRANSPORT_WINHTTP ON)
endif()
endif()
elseif (UNIX)
if (BUILD_TRANSPORT_WINHTTP)
message(FATAL_ERROR "WinHTTP transport adapter is not supported for POSIX platforms.")
endif()
if (BUILD_TRANSPORT_CURL OR (NOT BUILD_TRANSPORT_CUSTOM))
message("By default, if no option is selected, on POSIX, libcurl transport adapter is used.")
add_compile_definitions(BUILD_CURL_HTTP_TRANSPORT_ADAPTER)
if(AZ_ALL_LIBRARIES)
SET(BUILD_TRANSPORT_CURL ON)
if (BUILD_TRANSPORT_CURL OR (NOT BUILD_TRANSPORT_CURL AND NOT BUILD_TRANSPORT_CUSTOM))
if(NOT BUILD_TRANSPORT_CURL)
message("No transport adapter was selected, using libcurl as the default option for POSIX.")
endif()
add_compile_definitions(BUILD_CURL_HTTP_TRANSPORT_ADAPTER)
SET(BUILD_TRANSPORT_CURL ON)
endif()
else()
message(FATAL_ERROR "Unsupported platform.")
endif()

View File

@ -0,0 +1,74 @@
parameters:
- name: Artifacts
type: object
default: []
- name: ServiceDirectory
type: string
default: not-specified
- name: CMakeTestOptions
type: object
default: []
- name: CMakeTestDependencies
type: string
default: ''
jobs:
- job: CMakeGenerate
condition: and(succeededOrFailed(), ne(variables['Skip.CMakeGenerate'], 'true'))
strategy:
matrix:
Linux:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
CmakeEnvArg: ''
AptDependencies: 'libcurl4-openssl-dev'
VcpkgInstall: ${{ parameters.CMakeTestDependencies }}
VCPKG_DEFAULT_TRIPLET: 'x64-linux'
Windows:
Pool: azsdk-pool-mms-win-2019-general
OSVmImage: MMS2019
CmakeEnvArg: ''
VcpkgInstall: ${{ parameters.CMakeTestDependencies }}
VCPKG_DEFAULT_TRIPLET: 'x64-windows'
Mac:
Pool: Azure Pipelines
OSVmImage: macOS-10.15
CmakeEnvArg: ''
VcpkgInstall: 'openssl ${{ parameters.CMakeTestDependencies }}'
VCPKG_DEFAULT_TRIPLET: 'x64-osx'
pool:
name: $(Pool)
vmImage: $(OSVmImage)
variables:
CMOCKA_XML_FILE: "%g-test-results.xml"
steps:
- checkout: self
submodules: recursive
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
parameters:
AgentImage: $(OSVmImage)
- template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml
- pwsh: sudo apt update && sudo apt install -y $(AptDependencies)
condition: and(succeeded(), ne(variables['AptDependencies'], ''))
displayName: Install dependencies from apt
- template: /eng/pipelines/templates/steps/vcpkg.yml
parameters:
DependenciesVariableName: VcpkgInstall
- script: cmake --version
displayName: cmake --version
- ${{ each artifact in parameters.Artifacts }}:
- script: echo 'CMake generate tests for ${{ artifact.Name }}'
displayName: ${{ artifact.Name }}
- ${{ each cmakeOption in parameters.CMakeTestOptions }}:
- template: /eng/pipelines/templates/steps/cmake-generate.yml
parameters:
CmakeGeneratePath: sdk/${{ parameters.ServiceDirectory }}/${{ artifact.Path }}
GenerateArgs: ${{ cmakeOption.Value }}
Env: "$(CmakeEnvArg)"

View File

@ -38,9 +38,26 @@ parameters:
- name: TestEnv
type: object
default: []
- name: CMakeTestOptions
type: object
default: []
- name: CMakeTestDependencies
type: string
default: ''
stages:
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- stage: CMakeGeneration
jobs:
- template: /eng/pipelines/templates/jobs/archetype-sdk-cmake-generate.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
Artifacts: ${{ parameters.Artifacts }}
CMakeTestOptions: ${{ parameters.CMakeTestOptions }}
CMakeTestDependencies: ${{ parameters.CMakeTestDependencies }}
- stage: Build
dependsOn: []
jobs:
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:

View File

@ -0,0 +1,22 @@
parameters:
CmakeGeneratePath: ''
Env: ''
GenerateArgs: ''
steps:
- script: mkdir build
workingDirectory: ${{ parameters.CmakeGeneratePath }}
displayName: create working directory
- script: pwd
workingDirectory: ${{ parameters.CmakeGeneratePath }}/build
displayName: Show current path
- script: ${{ parameters.Env }} cmake ${{ parameters.GenerateArgs }} ..
workingDirectory: ${{ parameters.CmakeGeneratePath }}/build
displayName: cmake generate
- script: rm -rf build
workingDirectory: ${{ parameters.CmakeGeneratePath }}
displayName: clean build folder

View File

@ -1,6 +1,12 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
# setting CMAKE_TOOLCHAIN_FILE must happen before creating the project
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
az_vcpkg_integrate()
# Azure core is compatible with CMake 3.12
cmake_minimum_required (VERSION 3.12)
project(azure-core LANGUAGES CXX)
@ -9,17 +15,14 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
include(AzureVersion)
include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
# Add create_map_file function
include(CreateMapFile)
find_package(Threads REQUIRED)

View File

@ -72,4 +72,9 @@ stages:
- Name: STANDARD_STORAGE_CONNECTION_STRING
Value: "DefaultEndpointsProtocol=https;AccountName=fake;AccountKey=X;EndpointSuffix=core.windows.net"
- Name: ADLS_GEN2_CONNECTION_STRING
Value: "DefaultEndpointsProtocol=https;AccountName=fake;AccountKey=X;EndpointSuffix=core.windows.net"
Value: "DefaultEndpointsProtocol=https;AccountName=fake;AccountKey=X;EndpointSuffix=core.windows.net"
CMakeTestOptions:
- Name: Default
Value: ''
- Name: Test
Value: '-DBUILD_TESTING=ON'

View File

@ -1,6 +1,11 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
# setting CMAKE_TOOLCHAIN_FILE must happen before creating the project
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
az_vcpkg_integrate()
cmake_minimum_required (VERSION 3.13)
project(azure-identity LANGUAGES CXX)
@ -8,17 +13,14 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
include(AzureVersion)
include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
# Add create_map_file function
include(CreateMapFile)
if(NOT AZ_ALL_LIBRARIES)
find_package(azure-core-cpp "1.2.0" CONFIG QUIET)

View File

@ -30,6 +30,8 @@ stages:
LiveTestCtestRegex: azure-identity.
LineCoverageTarget: 99
BranchCoverageTarget: 63
# Dependencies per package is not supported. List the dependencies for all packages.
CMakeTestDependencies: 'azure-core-cpp'
Artifacts:
- Name: azure-identity
Path: azure-identity
@ -42,3 +44,12 @@ stages:
Value: "non-real-client"
- Name: AZURE_CLIENT_SECRET
Value: "non-real-secret"
CMakeTestOptions:
- Name: Default
Value: ''
- Name: Test
Value: '-DBUILD_TESTING=ON'
- Name: Samples
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON'
- Name: Performance
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON'

View File

@ -1,6 +1,11 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
# setting CMAKE_TOOLCHAIN_FILE must happen before creating the project
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
az_vcpkg_integrate()
cmake_minimum_required (VERSION 3.13)
project(azure-security-keyvault-certificates LANGUAGES CXX)
@ -8,17 +13,14 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
include(AzureVersion)
include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
# Add create_map_file function
include(CreateMapFile)
if(NOT AZ_ALL_LIBRARIES)
find_package(azure-core-cpp "1.2.0" CONFIG QUIET)

View File

@ -1,6 +1,11 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
# setting CMAKE_TOOLCHAIN_FILE must happen before creating the project
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
az_vcpkg_integrate()
cmake_minimum_required (VERSION 3.13)
project(azure-security-keyvault-keys LANGUAGES CXX)
@ -8,17 +13,14 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
include(AzureVersion)
include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
# Add create_map_file function
include(CreateMapFile)
if(NOT AZ_ALL_LIBRARIES)
find_package(azure-core-cpp "1.2.0" CONFIG QUIET)

View File

@ -1,6 +1,11 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
# setting CMAKE_TOOLCHAIN_FILE must happen before creating the project
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
az_vcpkg_integrate()
cmake_minimum_required (VERSION 3.13)
project(azure-security-keyvault-secrets LANGUAGES CXX)
@ -8,17 +13,14 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
include(AzureVcpkg)
include(AzureVersion)
include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
# Add create_map_file function
include(CreateMapFile)
if(NOT AZ_ALL_LIBRARIES)
find_package(azure-core-cpp "1.2.0" CONFIG QUIET)

View File

@ -32,6 +32,8 @@ stages:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
LineCoverageTarget: 81
BranchCoverageTarget: 42
# Dependencies per package is not supported. List the dependencies for all packages.
CMakeTestDependencies: 'azure-core-cpp azure-identity-cpp'
Artifacts:
- Name: azure-security-keyvault-keys
Path: azure-security-keyvault-keys
@ -54,3 +56,12 @@ stages:
Value: "non-real-client"
- Name: AZURE_CLIENT_SECRET
Value: "non-real-secret"
CMakeTestOptions:
- Name: Default
Value: ''
- Name: Test
Value: '-DBUILD_TESTING=ON'
- Name: Samples
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON'
- Name: Performance
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON'