mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-28 18:41:57 -05:00
Rework CI for C++2020 tests
This commit is contained in:
parent
03af2432e0
commit
d442c85820
@ -18,10 +18,12 @@ stages:
|
||||
parameters:
|
||||
jobName: 'Validate GCC latest'
|
||||
imageName: ubuntu-20.04
|
||||
CXXVersions: [ 14, 17 ]
|
||||
- template: ./pipelines/jobs.yml
|
||||
parameters:
|
||||
jobName: 'Validate GCC Previous'
|
||||
imageName: ubuntu-18.04
|
||||
CXXVersions: [ 14, 17 ]
|
||||
|
||||
# Clang
|
||||
- stage: Clang
|
||||
@ -40,6 +42,7 @@ stages:
|
||||
parameters:
|
||||
jobName: 'Validate Clang Previous'
|
||||
imageName: ubuntu-18.04
|
||||
CXXVersions: [ 14, 17 ]
|
||||
|
||||
# MSVC
|
||||
- stage: MSVC
|
||||
@ -53,6 +56,7 @@ stages:
|
||||
parameters:
|
||||
jobName: 'Validate MSVC Previous'
|
||||
imageName: vs2017-win2016
|
||||
CXXVersions: [ 14, 17 ]
|
||||
|
||||
# Apple-Clang
|
||||
- stage: Apple_Clang
|
||||
@ -62,7 +66,9 @@ stages:
|
||||
parameters:
|
||||
jobName: 'Validate Apple-Clang latest'
|
||||
imageName: macos-10.15
|
||||
CXXVersions: [ 14, 17 ]
|
||||
- template: ./pipelines/jobs.yml
|
||||
parameters:
|
||||
jobName: 'Validate Apple-Clang Previous'
|
||||
imageName: macos-10.14
|
||||
CXXVersions: [ 14, 17 ]
|
||||
|
@ -1,33 +1,19 @@
|
||||
parameters:
|
||||
jobName: ''
|
||||
imageName: ''
|
||||
CXXVersions: [ 14, 17, 20 ]
|
||||
buildTypes: [ 'Debug', 'Release' ]
|
||||
|
||||
jobs:
|
||||
- job:
|
||||
displayName: ${{ parameters.imageName }}
|
||||
pool:
|
||||
vmImage: ${{ parameters.imageName }}
|
||||
strategy:
|
||||
matrix:
|
||||
14_debug:
|
||||
GSL_CXX_STANDARD: '14'
|
||||
BUILD_TYPE: 'Debug'
|
||||
14_release:
|
||||
GSL_CXX_STANDARD: '14'
|
||||
BUILD_TYPE: 'Release'
|
||||
17_debug:
|
||||
GSL_CXX_STANDARD: '17'
|
||||
BUILD_TYPE: 'Debug'
|
||||
17_release:
|
||||
GSL_CXX_STANDARD: '17'
|
||||
BUILD_TYPE: 'Release'
|
||||
# Note: Currently, only some C++20 features are supported by GSL
|
||||
20_debug:
|
||||
GSL_CXX_STANDARD: '20'
|
||||
BUILD_TYPE: 'Debug'
|
||||
20_release:
|
||||
GSL_CXX_STANDARD: '20'
|
||||
BUILD_TYPE: 'Release'
|
||||
continueOnError: false
|
||||
steps:
|
||||
- template: ./steps.yml
|
||||
- ${{ each CXXVersion in parameters.CXXVersions }}:
|
||||
- ${{ each buildType in parameters.buildTypes }}:
|
||||
- job:
|
||||
displayName: ${{ format('{0} {1} C++{2}', parameters.imageName, buildType, CXXVersion) }}
|
||||
pool:
|
||||
vmImage: ${{ parameters.imageName }}
|
||||
continueOnError: false
|
||||
steps:
|
||||
- template: ./steps.yml
|
||||
parameters:
|
||||
buildType: ${{ buildType }}
|
||||
CXXVersion: ${{ CXXVersion }}
|
||||
|
@ -1,9 +1,13 @@
|
||||
parameters:
|
||||
buildType: ''
|
||||
CXXVersion: ''
|
||||
|
||||
steps:
|
||||
- task: CMake@1
|
||||
name: Configure
|
||||
inputs:
|
||||
workingDirectory: build
|
||||
cmakeArgs: '-DGSL_CXX_STANDARD=$(GSL_CXX_STANDARD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -Werror=dev .. '
|
||||
cmakeArgs: '-DGSL_CXX_STANDARD=${{ parameters.CXXVersion }} -DCMAKE_BUILD_TYPE=${{ parameters.buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev .. '
|
||||
|
||||
- task: CMake@1
|
||||
name: Build
|
||||
|
@ -9,6 +9,10 @@ include(ExternalProject)
|
||||
# will make visual studio generated project group files
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
if(CI_TESTING AND GSL_CXX_STANDARD EQUAL 20)
|
||||
add_compile_definitions(FORCE_STD_SPAN_TESTS=1)
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
add_compile_definitions(GTEST_HAS_DEATH_TEST=1 IOS_PROCESS_DELAY_WORKAROUND=1)
|
||||
endif()
|
||||
|
@ -119,7 +119,7 @@ TEST(at_tests, InitializerList)
|
||||
EXPECT_DEATH(gsl::at({1, 2, 3, 4}, 4), expected);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 202002L
|
||||
#if defined(FORCE_STD_SPAN_TESTS) || defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
|
||||
TEST(at_tests, std_span)
|
||||
{
|
||||
std::vector<int> vec{1, 2, 3, 4, 5};
|
||||
@ -145,7 +145,7 @@ TEST(at_tests, std_span)
|
||||
EXPECT_DEATH(gsl::at(csp, -1), expected);
|
||||
EXPECT_DEATH(gsl::at(csp, gsl::narrow_cast<gsl::index>(sp.size())), expected);
|
||||
}
|
||||
#endif // __cplusplus >= 202002L
|
||||
#endif // defined(FORCE_STD_SPAN_TESTS) || defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER >= 1910
|
||||
static constexpr bool test_constexpr()
|
||||
|
Loading…
Reference in New Issue
Block a user