Skip to content

Commit b0dba22

Browse files
committed
Verify that cargo xtask publish will work
This change allows us to perform a `publish --dry-run` for each of the crates to make sure this still works. Note that `cargo xtask publish --dry-run` will use, by default, the `dynamic-linking` feature of `openvino-sys` which requires an OpenVINO installation to compile against.
1 parent 3ed84bf commit b0dba22

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
run: |
6969
source /opt/intel/openvino_2022/setupvars.sh
7070
cargo test --features openvino-sys/runtime-linking
71+
- name: Verify publish
72+
run: RUST_LOG=debug cargo xtask publish --dry-run
7173

7274
# Build and test from an existing OpenVINO installation inside a Docker image (i.e. download the
7375
# binaries, then compile against these).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Some important notes about the path passed in `OPENVINO_BUILD_DIR`:
8686
the limitations on [`cargo:rustc-link-search`]).
8787

8888
The various OpenVINO libraries and dependencies are found using the [openvino-finder] crate. Turn on
89-
logging to troubleshoot any issues finding the right libraries, e.g., `RUST_LOG=info
89+
logging to troubleshoot any issues finding the right libraries, e.g., `RUST_LOG=debug
9090
OPENVINO_BUILD_DIR=... cargo build -vv`.
9191

9292
[openvino]: https://github.com/openvinotoolkit/openvino

crates/xtask/src/publish.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,30 @@ impl PublishCommand {
4242
let crates_dir = path_to_crates()?;
4343
for krate in PUBLICATION_ORDER {
4444
println!("> publish {}", krate);
45-
if !self.dry_run {
46-
let krate_dir = crates_dir.clone().join(krate);
47-
let exec_result = exec(
48-
Command::new("cargo")
49-
.arg("publish")
50-
.arg("--no-verify")
51-
.current_dir(&krate_dir),
52-
);
45+
let krate_dir = crates_dir.clone().join(krate);
46+
let mut command = Command::new("cargo");
47+
command.current_dir(&krate_dir).arg("publish");
48+
if self.dry_run {
49+
command.arg("--dry-run");
50+
} else {
51+
command.arg("--no-verify");
52+
}
53+
54+
let exec_result = exec(&mut command);
5355

54-
// We want to continue even if a crate does not publish: this allows us to re-run
55-
// the `publish` command if uploading one or more crates fails.
56-
if let Err(e) = exec_result {
56+
// We want to continue even if a crate does not publish: this allows us to re-run the
57+
// `publish` command if uploading one or more crates fails. In `--dry-run` mode,
58+
// however, we do want to fail the process immediately to identify any issues.
59+
if let Err(e) = exec_result {
60+
if self.dry_run {
61+
panic!("Failed to publish crate {}:\n {}", krate, e);
62+
} else {
5763
println!("Failed to publish crate {}, continuing:\n {}", krate, e);
5864
}
65+
}
5966

60-
// Hopefully this gives crates.io enough time for subsequent publications to work.
67+
// Hopefully this gives crates.io enough time for subsequent publications to work.
68+
if !self.dry_run {
6169
sleep(Duration::from_secs(20));
6270
}
6371
}

0 commit comments

Comments
 (0)