Repository navigation
[Go] Test the Go binding against release archives - #33287
Open
Danny On The Air (dannyota) wants to merge 8 commits into
Open
Danny On The Air (dannyota) wants to merge 8 commits into
Danny On The Air (dannyota) wants to merge 8 commits into
Conversation
TestSessionOptionsProfiling wrote its profile under a fixed /tmp path, which does not exist on Windows. It now writes into t.TempDir(), closes the session when the test ends, and checks that the profile file was written. Signed-off-by: Danny <dannyontheair@outlook.com>
A green `go test` is not enough evidence for CI: on main the suite exits 0 without running anything when no runtime is configured. The new go/internal/citest command checks a `go test -json` stream for package success and named passing tests and verifies the runtime version and API the tests report. It also derives the expected API from the binding's headers, and checks the module origin a consumer resolved. It uses only the standard library and does not load ONNX Runtime. Signed-off-by: Danny <dannyontheair@outlook.com>
go/examples/basic runs the add model through the public API and checks the output shape and every value. It closes the outputs, inputs and session before Shutdown and prints success only after cleanup succeeds. Optional flags check the initialized runtime version, the negotiated API and, when built as a dependency, the selected module version from build info, rejecting a replaced module. CI builds this example in a fresh module to test a released commit as a consumer would. Signed-off-by: Danny <dannyontheair@outlook.com>
Adds a workflow that runs on four hosted targets (Linux x64, Linux arm64, macOS arm64 and Windows x64) against the released ONNX Runtime 1.31.0 archives, pinned by SHA-256. Each target runs the race-enabled test suite from the checkout and checks its JSON output with citest: the named tests must pass and report the expected runtime and API version. It then builds the example in a fresh module that depends on release commit 402979a, verifies the module origin and runs inference. Negative checks confirm that a missing runtime, a wrong API, a wrong runtime version and a wrong origin each fail. Windows uses MSYS2 UCRT64 GCC so that -race works with cgo. The workflow runs on pull requests that touch go/ or the C API headers, and on manual dispatch, with read-only permissions. Signed-off-by: Danny <dannyontheair@outlook.com>
Signed-off-by: Danny <dannyontheair@outlook.com>
Signed-off-by: Danny <dannyontheair@outlook.com>
Signed-off-by: Danny <dannyontheair@outlook.com>
This reverts commit 697e8ed. Signed-off-by: Danny <dannyontheair@outlook.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Danny On The Air (dannyota)
October 12, 2026 02:43
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The workflow and supporting changes are thoroughly validated with focused unit and cross-platform integration coverage.
0 open findings
What changed in this PR
Adds cross-platform CI validating the Go binding against ONNX Runtime 1.31.0 release archives. No actionable issues found.
Changes:
- Adds archive verification and race-tested Go CI across four targets.
- Adds result, API, and module-origin validation helpers with tests.
- Adds a release-consumer example and improves profiling portability.
| File | Description |
|---|---|
.github/workflows/go-release-ci.yml |
Defines release-archive and consumer validation. |
go/internal/citest/main.go |
Implements CI evidence checks. |
go/internal/citest/main_test.go |
Tests CI checker behavior. |
go/examples/basic/main.go |
Adds release-consumer inference example. |
go/examples/basic/main_test.go |
Tests example validation helpers. |
go/onnxruntime/load_windows.go |
Safely converts native symbol addresses. |
go/onnxruntime/options_test.go |
Makes profiling tests portable and verifies output. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a workflow that tests the Go binding against the released ONNX Runtime 1.31.0 archives on Linux x64, Linux arm64, macOS arm64 and Windows x64.
Each target:
go test -raceongo/onnxruntime. The newgo/internal/citestchecker requires named passing tests and the expected runtime and API versions.go/examples/basicin a fresh module using release commit402979ac1bef89dcd55add41eaa7277c407599eb, verifies the module origin throughGOPROXY=direct, and checks inference output and cleanup.Windows uses MSYS2 UCRT64 GCC for cgo race tests. The profiling test now uses a temporary directory. The Windows loader converts native DLL symbol addresses in C so the package passes
go vet.The workflow runs on pull requests touching
go/, the workflow, or the C API headers, and on manual dispatch. Permissions are read-only, actions are pinned by commit, and no secrets are used.Motivation and Context
Issue #32535 requests a
go/v1.31.0tag at the release commit. This workflow checks that commit on all four targets as a consumer would use it. It also prevents a false green result when the checkout's Go suite exits without running tests because no runtime is configured.This PR is independent of #33282. The checker selects API 27 for the current checkout and API 31 for the upgrade profile. The fixed release consumer expects API 27.
Testing
c7b474aca606a9c005b69f1aecf6e6a8ce10b7ce, testing merge65b63047f2e8da5a21114697c2c4ef85917caea1throughpull_request. Each target passed 134 top-level tests with three skips, verified runtime 1.31.0/API 27, resolved the fixed release commit, returned[11 22 33 44 55 66], and passed the negative checks.