Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
10 changes: 8 additions & 2 deletions docs/Versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ 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).

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**

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.

Expand Down
2 changes: 1 addition & 1 deletion include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
31 changes: 31 additions & 0 deletions onnxruntime/test/shared_lib/test_version.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#include "core/session/onnxruntime_cxx_api.h"

#include <cstdint>
#include <charconv>
#include <optional>
#include <string>
#include <vector>

#include "absl/strings/str_split.h"
#include "gtest/gtest.h"

TEST(CApiTest, VersionConsistencyWithApiVersion) {
const auto version_string = Ort::GetVersionString();
const std::vector<std::string> 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> {
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);
}
Loading