Skip to content

Commit 3f7fed9

Browse files
authored
CI test が失敗しているのを修正した (#5)
* osxがx86_64になったのに対応した * Windows gpuのダウンロードに対応した * code生成時に変化がなくても成功するようにした * 一つの環境でcpu,gpuの複数ビルドが失敗する状態だったので失敗しないように修正 * successを復活した * 生成後にgit add --allするようにしてWindowsでの改行のみの変更を含めないようにした * Clippy errorを修正した * if: success() は不要のため削除 * ORT_OUT_DIRに出力されたファイルに変更や削除が入るとbuild scriptをrerunするようにした  depsに出力されているファイルが削除されることがあるようなので、テストが失敗することがあるのでそれを解消するため * version up onnxruntime-sys
1 parent 8b45a4a commit 3f7fed9

File tree

5 files changed

+35
-21
lines changed

5 files changed

+35
-21
lines changed

.github/actions/auto_gen_bind_pr/action.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ runs:
2222
# cargoのキャシュが原因でテストが失敗してることが考えられる場合はバージョン部分を変更する
2323
key: "v1-cargo-test-cache-${{ inputs.triple }}"
2424
- name: gen bind
25-
run: cargo build --target ${{ inputs.triple }} --features generate-bindings
26-
shell: bash
27-
- name: check
28-
run: git status -s | grep -E "M|A"
25+
run: cargo build --target ${{ inputs.triple }} --features generate-bindings && git add --all
2926
shell: bash
3027
- name: create_pr
31-
if: success()
3228
id: cpr
3329
uses: peter-evans/create-pull-request@v4
3430
with:

.github/workflows/general.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
command: build
5454
args: --target x86_64-apple-darwin
5555
- name: Verify prebuilt archive downloaded (CPU, x86_64-apple-darwin)
56-
run: ls -lh target/x86_64-apple-darwin/debug/build/onnxruntime-sys-*/out/onnxruntime-osx-x64-1.*.tgz
56+
run: ls -lh target/x86_64-apple-darwin/debug/build/onnxruntime-sys-*/out/onnxruntime-osx-x86_64-1.*.tgz
5757
# ******************************************************************
5858
- name: Download prebuilt archive (CPU, i686-pc-windows-msvc)
5959
uses: actions-rs/cargo@v1
@@ -89,7 +89,7 @@ jobs:
8989
command: build
9090
args: --target x86_64-pc-windows-msvc
9191
- name: Verify prebuilt archive downloaded (GPU, x86_64-pc-windows-msvc)
92-
run: ls -lh target/x86_64-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-gpu-x64-1.*.zip
92+
run: ls -lh target/x86_64-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-x64-gpu-1.*.zip
9393

9494
rust-test:
9595
strategy:
@@ -122,7 +122,9 @@ jobs:
122122
with:
123123
# cargoのキャシュが原因でテストが失敗してることが考えられる場合はバージョン部分を変更する
124124
key: "v1-cargo-test-cache-${{ matrix.os }}"
125-
- run: cargo test
125+
- name: Run cargo test
126+
shell: bash
127+
run: cargo test
126128

127129
clippy:
128130
name: Clippy
@@ -151,13 +153,6 @@ jobs:
151153
with:
152154
toolchain: stable
153155
override: true
154-
- name: Build (required to download libonnxruntime)
155-
uses: actions-rs/cargo@v1
156-
with:
157-
command: build
158-
args: --package onnxruntime-sys
159-
- name: Copy libonnxruntime.*.dylib to /usr/lib/
160-
run: sudo cp -r target/debug/build/onnxruntime-sys-*/out/onnxruntime/onnxruntime-*/lib/libonnxruntime.* /usr/lib/
161156
- name: Run cargo-tarpaulin
162157
uses: actions-rs/[email protected]
163158
with:

onnxruntime-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = ["Nicolas Bigaouette <[email protected]>"]
33
edition = "2018"
44
name = "onnxruntime-sys"
5-
version = "0.0.24"
5+
version = "0.0.25"
66

77
description = "Unsafe wrapper around Microsoft's ONNX Runtime"
88
documentation = "https://docs.rs/onnxruntime-sys"

onnxruntime-sys/build.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,17 @@ fn main() {
9292
(export_include_dir, export_lib_dir)
9393
};
9494
if let Ok(ort_lib_out_dir) = env::var(ORT_ENV_OUT_DIR) {
95-
output_onnxruntime_library(&lib_dir, ort_lib_out_dir);
95+
output_onnxruntime_library(&lib_dir, &ort_lib_out_dir);
96+
for entry in lib_dir.read_dir().unwrap().flat_map(|e| e.ok()) {
97+
let path = entry.path();
98+
if path.is_file() {
99+
let file_name = path.file_name().unwrap().to_str().unwrap();
100+
println!(
101+
"cargo:rerun-if-changed={}",
102+
Path::new(&ort_lib_out_dir).join(file_name).display()
103+
);
104+
}
105+
}
96106
}
97107

98108
println!("Include directory: {:?}", include_dir);
@@ -259,7 +269,7 @@ fn extract_zip(filename: &Path, outpath: &Path) {
259269
let mut file = archive.by_index(i).unwrap();
260270
#[allow(deprecated)]
261271
let outpath = outpath.join(file.sanitized_name());
262-
if !(&*file.name()).ends_with('/') {
272+
if !file.name().ends_with('/') {
263273
println!(
264274
"File {} extracted to \"{}\" ({} bytes)",
265275
i,
@@ -469,7 +479,20 @@ fn prepare_libort_dir_prebuilt() -> PathBuf {
469479
let (prebuilt_archive, prebuilt_url) = prebuilt_archive_url();
470480

471481
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
472-
let extract_dir = out_dir.join(&format!("{}_{}", ORT_PREBUILT_EXTRACT_DIR, ORT_VERSION));
482+
let extract_dir = out_dir.join(&format!(
483+
"{}_{}_{}",
484+
ORT_PREBUILT_EXTRACT_DIR,
485+
ORT_VERSION,
486+
if matches!(TRIPLET.accelerator, Accelerator::Gpu) {
487+
"gpu"
488+
} else {
489+
#[cfg(not(feature = "directml"))]
490+
let accelerator = "cpu";
491+
#[cfg(feature = "directml")]
492+
let accelerator = "directml";
493+
accelerator
494+
}
495+
));
473496
let downloaded_file = out_dir.join(&prebuilt_archive);
474497

475498
println!("cargo:rerun-if-changed={}", downloaded_file.display());

onnxruntime/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = ["Nicolas Bigaouette <[email protected]>"]
33
edition = "2018"
44
name = "onnxruntime"
5-
version = "0.0.29"
5+
version = "0.0.30"
66

77
description = "Wrapper around Microsoft's ONNX Runtime"
88
documentation = "https://docs.rs/onnxruntime"
@@ -19,7 +19,7 @@ name = "integration_tests"
1919
required-features = ["model-fetching"]
2020

2121
[dependencies]
22-
onnxruntime-sys = { path = "../onnxruntime-sys", version = "0.0.24" }
22+
onnxruntime-sys = { path = "../onnxruntime-sys", version = "0.0.25" }
2323

2424
lazy_static = "1.4"
2525
ndarray = "0.15"

0 commit comments

Comments
 (0)