Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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 .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
docker_image_repo: onnxruntimecpubuildpythonx64
extra_build_flags: '--use_binskim_compliant_compile_flags --build_wheel --build_nuget --enable_transformers_tool_test --cmake_extra_defines onnxruntime_BUILD_BENCHMARKS=ON'
python_path_prefix: 'PATH=/opt/python/cp310-cp310/bin:$PATH' # $ needs escaping in single quotes
run_go_tests: true
job_identifier: build-linux-x64-release
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/reusable_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ on:
required: false
type: boolean
default: true
run_go_tests:
description: 'Whether to run the Go binding race tests against the built shared library'
required: false
type: boolean
default: false
upload_build_output:
description: 'Whether to upload the build output directory as an artifact (used when tests are skipped)'
required: false
Expand Down Expand Up @@ -150,6 +155,24 @@ jobs:
extra_build_flags: ${{ inputs.extra_build_flags }} --use_cache
python_path_prefix: ${{ inputs.python_path_prefix }}

- name: Set up Go
if: inputs.run_go_tests == true
uses: actions/setup-go@v6
with:
go-version-file: go/go.mod
cache: false

- name: Test Go bindings
if: inputs.run_go_tests == true
shell: bash
working-directory: go
env:
ORT_LIB_PATH: ${{ runner.temp }}/${{ inputs.build_config }}/${{ inputs.build_config }}
run: |
set -euo pipefail
test -f "${ORT_LIB_PATH}/libonnxruntime.so"
go test -race -count=1 ./onnxruntime

# ------------- Prepare Artifact Step -------------
- name: Prepare Build Output for Upload
if: inputs.upload_build_output == true
Expand Down
1 change: 1 addition & 0 deletions go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.ort-lib/
32 changes: 32 additions & 0 deletions go/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "2"

run:
modules-download-mode: readonly
timeout: 10m

linters:
enable:
- gocritic
- govet
- errcheck
- staticcheck
- unused
- ineffassign
- gosec
settings:
gocritic:
enabled-checks:
- evalOrder
disabled-checks:
- ifElseChain
- dupSubExpr
gosec:
excludes:
# CGO pointer passing is intentional in this binding library.
- G103
exclusions:
rules:
- linters:
- errcheck
- gosec
path: _test\.go
3 changes: 3 additions & 0 deletions go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/microsoft/onnxruntime/go

go 1.26
Loading
Loading