From a4d6ca9ed5b487a8090bc092e4730f9b6c78c358 Mon Sep 17 00:00:00 2001 From: edgchen1 <18449977+edgchen1@users.noreply.github.com> Date: Fri, 6 Feb 2026 19:11:45 -0800 Subject: [PATCH 1/4] update ORT_API_VERSION --- include/onnxruntime/core/session/onnxruntime_c_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/onnxruntime/core/session/onnxruntime_c_api.h b/include/onnxruntime/core/session/onnxruntime_c_api.h index 221f3673f2027..77c2ff795e800 100644 --- a/include/onnxruntime/core/session/onnxruntime_c_api.h +++ b/include/onnxruntime/core/session/onnxruntime_c_api.h @@ -38,7 +38,7 @@ * * This value is used by some API functions to behave as this version of the header expects. */ -#define ORT_API_VERSION 24 +#define ORT_API_VERSION 25 #ifdef __cplusplus extern "C" { From 50321d53526a8b942d683840b3c11543749b0135 Mon Sep 17 00:00:00 2001 From: edgchen1 <18449977+edgchen1@users.noreply.github.com> Date: Fri, 6 Feb 2026 19:12:32 -0800 Subject: [PATCH 2/4] update instructions in Versioning.md --- docs/Versioning.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/Versioning.md b/docs/Versioning.md index a8d26f7d74185..fd9f321395d81 100644 --- a/docs/Versioning.md +++ b/docs/Versioning.md @@ -57,13 +57,18 @@ npm --version # Should be v8.0 or newer Replace `X.Y.Z` with your new version number. The comments following this assert explain additional steps if new APIs were added to this release. -4. **Review all changes** +4. **Update the C API header `ORT_API_VERSION` value (Manual Step)** + + The script does **not** update the value of `ORT_API_VERSION` in [include/onnxruntime/core/session/onnxruntime_c_api.h](../include/onnxruntime/core/session/onnxruntime_c_api.h). + That should be updated too if the API has changed. + +5. **Review all changes** Review all modified files. Verify: - Version numbers are correct in all updated files - The release notes URL format is correct (e.g., `https://github.com/Microsoft/onnxruntime/releases/tag/vX.Y.Z`) -5. **Commit and create PR** +6. **Commit and create PR** Commit all changes and create a PR targeting `main` or a release branch as appropriate. From 8572b90e5d2cd62e07a6d5f1e61aa60e7119d53f Mon Sep 17 00:00:00 2001 From: edgchen1 <18449977+edgchen1@users.noreply.github.com> Date: Fri, 6 Feb 2026 19:20:41 -0800 Subject: [PATCH 3/4] add test to ensure ORT_API_VERSION is equal to the second component of the version string --- cmake/onnxruntime_unittests.cmake | 1 + docs/Versioning.md | 3 +- onnxruntime/test/shared_lib/test_version.cc | 31 +++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 onnxruntime/test/shared_lib/test_version.cc diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 988b98fb29d48..b4688abe97b24 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -590,6 +590,7 @@ set (onnxruntime_shared_lib_test_SRC ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_run_options.cc ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_runtime_path.cc ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_session_options.cc + ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_version.cc ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/utils.h ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/utils.cc ) diff --git a/docs/Versioning.md b/docs/Versioning.md index fd9f321395d81..904e4f777561e 100644 --- a/docs/Versioning.md +++ b/docs/Versioning.md @@ -60,7 +60,8 @@ npm --version # Should be v8.0 or newer 4. **Update the C API header `ORT_API_VERSION` value (Manual Step)** The script does **not** update the value of `ORT_API_VERSION` in [include/onnxruntime/core/session/onnxruntime_c_api.h](../include/onnxruntime/core/session/onnxruntime_c_api.h). - That should be updated too if the API has changed. + + The value should be set to the second component of the version string. E.g., `25` for version `1.25.0`. 5. **Review all changes** diff --git a/onnxruntime/test/shared_lib/test_version.cc b/onnxruntime/test/shared_lib/test_version.cc new file mode 100644 index 0000000000000..db980c7ed2312 --- /dev/null +++ b/onnxruntime/test/shared_lib/test_version.cc @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#include "core/session/onnxruntime_cxx_api.h" + +#include +#include +#include +#include +#include + +#include "absl/strings/str_split.h" +#include "gtest/gtest.h" + +TEST(CApiTest, VersionConsistencyWithApiVersion) { + const auto version_string = Ort::GetVersionString(); + const std::vector version_string_components = absl::StrSplit(version_string, '.'); + ASSERT_EQ(version_string_components.size(), size_t{3}); + + auto to_uint32_t = [](const std::string& s) -> std::optional { + uint32_t result{}; + if(std::from_chars(s.data(), s.data() + s.size(), result).ec == std::errc{}) { + return result; + } + return std::nullopt; + }; + + ASSERT_NE(to_uint32_t(version_string_components[0]), std::nullopt); + ASSERT_EQ(to_uint32_t(version_string_components[1]), uint32_t{ORT_API_VERSION}); + ASSERT_NE(to_uint32_t(version_string_components[0]), std::nullopt); +} From 4a04ff0ec338eba1122063641840f844a01ef265 Mon Sep 17 00:00:00 2001 From: edgchen1 <18449977+edgchen1@users.noreply.github.com> Date: Fri, 6 Feb 2026 19:27:08 -0800 Subject: [PATCH 4/4] lint --- onnxruntime/test/shared_lib/test_version.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/test/shared_lib/test_version.cc b/onnxruntime/test/shared_lib/test_version.cc index db980c7ed2312..5427378e7788a 100644 --- a/onnxruntime/test/shared_lib/test_version.cc +++ b/onnxruntime/test/shared_lib/test_version.cc @@ -19,8 +19,8 @@ TEST(CApiTest, VersionConsistencyWithApiVersion) { auto to_uint32_t = [](const std::string& s) -> std::optional { uint32_t result{}; - if(std::from_chars(s.data(), s.data() + s.size(), result).ec == std::errc{}) { - return result; + if (std::from_chars(s.data(), s.data() + s.size(), result).ec == std::errc{}) { + return result; } return std::nullopt; };