Skip to content

Commit 30d99b3

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 e687811 commit 30d99b3

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ jobs:
9090
run: |
9191
source /opt/intel/openvino_2022/setupvars.sh
9292
cargo test --features openvino-sys/runtime-linking
93+
- name: Verify publish
94+
run: cargo xtask publish --dry-run
9395

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

crates/xtask/src/publish.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,25 @@ 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+
}
5353

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 {
57-
println!("Failed to publish crate {}, continuing:\n {}", krate, e);
58-
}
54+
let exec_result = exec(&mut command);
5955

60-
// Hopefully this gives crates.io enough time for subsequent publications to work.
56+
// We want to continue even if a crate does not publish: this allows us to re-run
57+
// the `publish` command if uploading one or more crates fails.
58+
if let Err(e) = exec_result {
59+
println!("Failed to publish crate {}, continuing:\n {}", krate, e);
60+
}
61+
62+
// Hopefully this gives crates.io enough time for subsequent publications to work.
63+
if !self.dry_run {
6164
sleep(Duration::from_secs(20));
6265
}
6366
}

0 commit comments

Comments
 (0)