From 2b4d40b96d293e77dece74a581bd0b327bbe6c52 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 24 Dec 2024 22:53:27 +0800 Subject: [PATCH] Release `v0.1.5` Signed-off-by: Xavier Lau --- Cargo.lock | 25 +++++++++++++++++++++++-- Cargo.toml | 3 ++- Dockerfile | 2 +- action/build/action.yml | 2 +- cli/src/cli/build.rs | 8 ++++---- lib/Cargo.toml | 1 + lib/src/docker.rs | 7 +++++-- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa9851c..501d579 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -313,6 +313,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.4.0" @@ -1743,6 +1754,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.9" @@ -2789,7 +2809,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "polkadot-runtime-releaser-cli" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "array-bytes 8.0.0", @@ -2807,8 +2827,9 @@ dependencies = [ [[package]] name = "polkadot-runtime-releaser-lib" -version = "0.1.4" +version = "0.1.5" dependencies = [ + "atty", "blake2", "frame-metadata 18.0.0", "md-5", diff --git a/Cargo.toml b/Cargo.toml index ba9cc75..b3beda3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,12 +11,13 @@ edition = "2021" homepage = "https://hack.ink/polkadot-runtime-releaser" license = "GPL-3.0" repository = "https://github.com/hack-ink/polkadot-runtime-releaser" -version = "0.1.4" +version = "0.1.5" [workspace.dependencies] # crates.io anyhow = { version = "1.0" } array-bytes = { version = "8.0" } +atty = { version = "0.2" } blake2 = { version = "0.10" } chrono = { version = "0.4" } clap = { version = "4.5" } diff --git a/Dockerfile b/Dockerfile index e0ed7ce..50becf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:25.04 LABEL maintainer="x@acg.box" LABEL description="An environment for constructing a deterministic polkadot-sdk-based runtime." -LABEL version="0.1.4" +LABEL version="0.1.5" RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ diff --git a/action/build/action.yml b/action/build/action.yml index 1d5d71f..606860f 100644 --- a/action/build/action.yml +++ b/action/build/action.yml @@ -27,7 +27,7 @@ runs: - name: Setup Polkadot Runtime Releaser shell: bash run: curl - -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.4/prr-x86_64-unknown-linux-gnu.tar.gz | + -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.5/prr-x86_64-unknown-linux-gnu.tar.gz | tar xz && chmod u+x prr && mv prr /usr/local/bin/prr diff --git a/cli/src/cli/build.rs b/cli/src/cli/build.rs index f2b632c..c88a22f 100644 --- a/cli/src/cli/build.rs +++ b/cli/src/cli/build.rs @@ -18,7 +18,7 @@ pub struct BuildCmd { runtime: String, /// The features to enable for the runtime crate. #[arg(long, short, value_name = "FEATURES")] - features: String, + features: Option, /// Whether to store the compressed runtime only. #[arg(long)] no_compressed_only: bool, @@ -28,7 +28,7 @@ pub struct BuildCmd { #[arg(long, short, value_name = "VER", verbatim_doc_comment)] toolchain_version: Option, /// Image version of the . - #[arg(long, short = 'v', value_name = "VER", default_value_t = String::from("0.1.4"), conflicts_with = "override_docker_image")] + #[arg(long, short = 'v', value_name = "VER", default_value_t = String::from("0.1.5"), conflicts_with = "override_docker_image")] image_version: String, /// Overwrite the default docker image with the specified one. /// Use `docker images` to list the available images on your system. @@ -115,9 +115,9 @@ impl Run for BuildCmd { let mut cmd = vec!["cargo", "b", "-r", "--locked", "-p", &runtime]; - if !features.is_empty() { + if let Some(feat) = &features { cmd.push("--features"); - cmd.push(&features); + cmd.push(feat); } run_args.with_command(&cmd); diff --git a/lib/Cargo.toml b/lib/Cargo.toml index eaf0ffb..a0ef54f 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,6 +11,7 @@ version.workspace = true [dependencies] # crates.io +atty = { workspace = true } blake2 = { workspace = true } frame-metadata = { workspace = true } md-5 = { workspace = true } diff --git a/lib/src/docker.rs b/lib/src/docker.rs index aa71553..d46575c 100644 --- a/lib/src/docker.rs +++ b/lib/src/docker.rs @@ -1,5 +1,7 @@ //! Polkadot Runtime Releaser Docker component. +// crates.io +use atty::Stream; // self use crate::{ prelude::*, @@ -50,7 +52,8 @@ impl<'a> RunArgs<'a> { } impl CliArgs for RunArgs<'_> { fn to_cli_args(&self) -> Vec<&str> { - let mut args = vec!["run", "-it", "--rm"]; + let maybe_it = if atty::is(Stream::Stdin) { "-it" } else { "-t" }; + let mut args = vec!["run", maybe_it, "--rm"]; for env in &self.envs { args.extend_from_slice(&["-e", env]); @@ -81,7 +84,7 @@ fn to_cli_args_should_work() { cli_args, vec![ "run", - "-it", + "-t", "--rm", "-e", "FOO=bar",