Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify that cargo xtask publish will work #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ jobs:
- uses: abrown/install-openvino-action@v3
- name: Build and run tests
run: |
source /opt/intel/openvino_2022/setupvars.sh
cargo test --features openvino-sys/runtime-linking
source /opt/intel/openvino_2022/setupvars.sh
cargo test --features openvino-sys/runtime-linking
- name: Verify publish
run: |
source /opt/intel/openvino_2022/setupvars.sh
RUST_LOG=debug cargo xtask publish --dry-run

# Build and test from an existing OpenVINO installation inside a Docker image (i.e. download the
# binaries, then compile against these).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Some important notes about the path passed in `OPENVINO_BUILD_DIR`:
the limitations on [`cargo:rustc-link-search`]).

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

[openvino]: https://github.com/openvinotoolkit/openvino
Expand Down
32 changes: 20 additions & 12 deletions crates/xtask/src/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,30 @@ impl PublishCommand {
let crates_dir = path_to_crates()?;
for krate in PUBLICATION_ORDER {
println!("> publish {}", krate);
if !self.dry_run {
let krate_dir = crates_dir.clone().join(krate);
let exec_result = exec(
Command::new("cargo")
.arg("publish")
.arg("--no-verify")
.current_dir(&krate_dir),
);
let krate_dir = crates_dir.clone().join(krate);
let mut command = Command::new("cargo");
command.current_dir(&krate_dir).arg("publish");
if self.dry_run {
command.arg("--dry-run");
} else {
command.arg("--no-verify");
}

let exec_result = exec(&mut command);

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

// Hopefully this gives crates.io enough time for subsequent publications to work.
// Hopefully this gives crates.io enough time for subsequent publications to work.
if !self.dry_run {
sleep(Duration::from_secs(20));
}
}
Expand Down