Skip to content

Commit 9b6471f

Browse files
committed
fix(ci): CI 预置 ONNX Runtime 库(ORT_LIB_LOCATION 同本地机制)
1 parent f56fbe1 commit 9b6471f

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

‎.github/workflows/pr-check.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,25 @@ jobs:
9696
- name: Remove local cargo config (CI online download)
9797
shell: bash
9898
run: rm -f app/src-tauri/.cargo/config.toml
99+
# oar-ocr 未启用 ort-sys 的 download-binaries feature(本地靠 ORT_LIB_LOCATION 链接),
100+
# CI 必须手动提供 ONNX Runtime 库,与本地 ORT_LIB_LOCATION 同机制(CPU 包即可,测试不初始化 CUDA)
101+
- name: Prepare ONNX Runtime for CI
102+
shell: bash
103+
run: |
104+
mkdir -p app/src-tauri/ort/ci
105+
curl -sL https://github.com/microsoft/onnxruntime/releases/download/v1.28.0/onnxruntime-win-x64-1.28.0.zip -o /tmp/ort.zip
106+
unzip -q /tmp/ort.zip -d /tmp/ortx
107+
cp /tmp/ortx/onnxruntime-win-x64-1.28.0/lib/onnxruntime.* app/src-tauri/ort/ci/
99108
- name: Test
109+
# ORT_PREFER_DYNAMIC_LINK=1:与本地一致走动态链接,规避 static MT 与项目 MD 运行时的 LNK2038 冲突
110+
env:
111+
ORT_LIB_LOCATION: ort/ci
112+
ORT_PREFER_DYNAMIC_LINK: "1"
100113
run: cd app/src-tauri && cargo test
101114
- name: Lint (clippy)
115+
env:
116+
ORT_LIB_LOCATION: ort/ci
117+
ORT_PREFER_DYNAMIC_LINK: "1"
102118
run: cd app/src-tauri && cargo clippy -- -D warnings
103119

104120
# ===========================================================================

‎.github/workflows/release.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,20 @@ jobs:
4343
- name: Remove local cargo config (CI online download)
4444
shell: bash
4545
run: rm -f app/src-tauri/.cargo/config.toml
46+
# oar-ocr 未启用 ort-sys 的 download-binaries feature(本地靠 ORT_LIB_LOCATION 链接),
47+
# CI 必须手动提供 ONNX Runtime 库,与本地 ORT_LIB_LOCATION 同机制(CPU 包即可,测试不初始化 CUDA)
48+
- name: Prepare ONNX Runtime for CI
49+
shell: bash
50+
run: |
51+
mkdir -p app/src-tauri/ort/ci
52+
curl -sL https://github.com/microsoft/onnxruntime/releases/download/v1.28.0/onnxruntime-win-x64-1.28.0.zip -o /tmp/ort.zip
53+
unzip -q /tmp/ort.zip -d /tmp/ortx
54+
cp /tmp/ortx/onnxruntime-win-x64-1.28.0/lib/onnxruntime.* app/src-tauri/ort/ci/
4655
- name: Test
56+
# ORT_PREFER_DYNAMIC_LINK=1:与本地一致走动态链接,规避 static MT 与项目 MD 运行时的 LNK2038 冲突
57+
env:
58+
ORT_LIB_LOCATION: ort/ci
59+
ORT_PREFER_DYNAMIC_LINK: "1"
4760
run: cd app/src-tauri && cargo test
4861

4962
build:
@@ -79,7 +92,16 @@ jobs:
7992
# CI 无法 unset env,直接移除 config 使注入消失,两库回退在线下载(CI 网络可达)
8093
run: |
8194
rm -f app/src-tauri/.cargo/config.toml
95+
mkdir -p app/src-tauri/ort/ci
96+
curl -sL https://github.com/microsoft/onnxruntime/releases/download/v1.28.0/onnxruntime-win-x64-1.28.0.zip -o /tmp/ort.zip
97+
unzip -q /tmp/ort.zip -d /tmp/ortx
98+
cp /tmp/ortx/onnxruntime-win-x64-1.28.0/lib/onnxruntime.* app/src-tauri/ort/ci/
8299
cd app && npx tauri build --bundles nsis
100+
# oar-ocr 未启用 ort-sys download-binaries(本地靠 ORT_LIB_LOCATION 链接),
101+
# CI 手动提供 ORT 库并复用同一机制;动态链接规避 LNK2038(同本地 config)
102+
env:
103+
ORT_LIB_LOCATION: ort/ci
104+
ORT_PREFER_DYNAMIC_LINK: "1"
83105
- uses: actions/upload-artifact@v4
84106
with:
85107
name: release-windows-latest

0 commit comments

Comments
 (0)