Skip to content

Commit

Permalink
[BUILD] Introduce CXX 20 CI pipeline for MSVC/Windows (#2450)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Dec 14, 2023
1 parent ab440e4 commit 03f2a69
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,22 @@ jobs:
- name: run tests
run: ./ci/do_ci.ps1 cmake.maintainer.test

cmake_msvc_maintainer_test_stl_cxx20:
name: CMake msvc (maintainer mode) with C++20
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
run: |
./ci/setup_windows_cmake.ps1
./ci/setup_windows_ci_environment.ps1
- name: run tests
env:
CXX_STANDARD: '20'
run: ./ci/do_ci.ps1 cmake.maintainer.cxx20.stl.test

cmake_with_async_export_test:
name: CMake test (without otlp-exporter and with async export)
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Increment the:
[#2435](https://github.com/open-telemetry/opentelemetry-cpp/pull/2435)
* [BUILD] Fix removing of NOMINMAX on Windows
[#2449](https://github.com/open-telemetry/opentelemetry-cpp/pull/2449)
* [BUILD] Introduce CXX 20 CI pipeline for MSVC/Windows
[#2450](https://github.com/open-telemetry/opentelemetry-cpp/pull/2450)

Important changes:

Expand Down
4 changes: 2 additions & 2 deletions api/test/nostd/string_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ TEST(StringViewTest, SubstrPortion)
TEST(StringViewTest, SubstrOutOfRange)
{
string_view s = "abc123";
#if __EXCEPTIONS || ((defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020)))
EXPECT_THROW(s.substr(10), std::out_of_range);
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2017))
EXPECT_THROW((void)s.substr(10), std::out_of_range);
#else
EXPECT_DEATH({ s.substr(10); }, "");
#endif
Expand Down
2 changes: 1 addition & 1 deletion api/test/nostd/variant_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST(VariantTest, Get)
EXPECT_EQ(nostd::get<int>(w), 12);
EXPECT_EQ(*nostd::get_if<int>(&v), 12);
EXPECT_EQ(nostd::get_if<float>(&v), nullptr);
#if __EXCEPTIONS
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2017))
EXPECT_THROW(nostd::get<float>(w), nostd::bad_variant_access);
#else
EXPECT_DEATH({ nostd::get<float>(w); }, "");
Expand Down
24 changes: 24 additions & 0 deletions ci/do_ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ switch ($action) {
exit $exit
}
}
"cmake.maintainer.cxx20.stl.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DWITH_STL=CXX20 `
-DCMAKE_CXX_STANDARD=20 `
-DOTELCPP_MAINTAINER_MODE=ON `
-DWITH_NO_DEPRECATED_CODE=ON `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
cmake --build . -j $nproc
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
ctest -C Debug
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
}
"cmake.with_async_export.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
Expand Down

0 comments on commit 03f2a69

Please sign in to comment.