From 45a06e77b916c54de423929d10d401b84a662a33 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 26 Dec 2024 02:48:08 +0800 Subject: [PATCH] Release `v0.1.8` --- Cargo.lock | 4 +-- Cargo.toml | 2 +- action/build/action.yml | 8 +++++- action/inspect/action.yml | 2 +- action/override/action.yml | 6 ++++- action/try-runtime/action.yml | 2 +- cli/src/cli/build.rs | 46 ++++++++++++++++++++++++++--------- cli/src/cli/inspect.rs | 6 ++--- docker/Dockerfile | 2 +- 9 files changed, 56 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dc0dc61..9a6f00d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2809,7 +2809,7 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "polkadot-runtime-releaser-cli" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anyhow", "array-bytes 8.0.0", @@ -2828,7 +2828,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-releaser-lib" -version = "0.1.7" +version = "0.1.8" dependencies = [ "atty", "blake2", diff --git a/Cargo.toml b/Cargo.toml index ef5ed48..6e6ae2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ 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.7" +version = "0.1.8" [workspace.dependencies] # crates.io diff --git a/action/build/action.yml b/action/build/action.yml index 7e1475f..545a2da 100644 --- a/action/build/action.yml +++ b/action/build/action.yml @@ -8,6 +8,9 @@ inputs: runtime: description: "Target runtime to build." required: true + override-runtime-name: + description: "The name to use matching the runtime artifacts." + required: false features: description: "Features to enable for the runtime." required: false @@ -27,7 +30,7 @@ runs: - name: Setup Polkadot Runtime Releaser shell: bash run: curl - -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.7/prr-x86_64-unknown-linux-gnu.tar.gz | + -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.8/prr-x86_64-unknown-linux-gnu.tar.gz | tar xz && chmod u+x prr && mv prr /usr/local/bin/prr @@ -36,6 +39,9 @@ runs: run: | CMD="prr build ${{ inputs.runtime }}" + if [ ! -z "${{ inputs.override-runtime-name }}" ]; then + CMD="$CMD -n ${{ inputs.override-runtime-name }}" + fi if [ ! -z "${{ inputs.features }}" ]; then CMD="$CMD -f ${{ inputs.features }}" fi diff --git a/action/inspect/action.yml b/action/inspect/action.yml index 242697d..88b62d2 100644 --- a/action/inspect/action.yml +++ b/action/inspect/action.yml @@ -15,7 +15,7 @@ runs: - name: Setup Polkadot Runtime Releaser shell: bash run: curl - -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.7/prr-x86_64-unknown-linux-gnu.tar.gz | + -L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.8/prr-x86_64-unknown-linux-gnu.tar.gz | tar xz && chmod u+x prr && mv prr /usr/local/bin/prr diff --git a/action/override/action.yml b/action/override/action.yml index f4a9a81..920def3 100644 --- a/action/override/action.yml +++ b/action/override/action.yml @@ -14,6 +14,9 @@ inputs: runtime: description: "Target runtime to build." required: true + override-runtime-name: + description: "The name to use matching the runtime artifacts." + required: false features: description: "Features to enable for the runtime." required: true @@ -40,9 +43,10 @@ runs: ref: ${{ inputs.ref }} path: runtime - name: Build runtime - uses: hack-ink/polkadot-runtime-releaser/action/build@main + uses: hack-ink/polkadot-runtime-releaser/action/build@0.1.8 with: runtime: ${{ inputs.runtime }} + override-runtime-name: ${{ inputs.override-runtime-name }} features: ${{ inputs.features }} toolchain-ver: ${{ inputs.toolchain-ver }} workdir: runtime diff --git a/action/try-runtime/action.yml b/action/try-runtime/action.yml index bc4f3c4..53af5d4 100644 --- a/action/try-runtime/action.yml +++ b/action/try-runtime/action.yml @@ -33,7 +33,7 @@ runs: chmod +x try-runtime && mv try-runtime /usr/local/bin/try-runtime - name: Build runtime - uses: hack-ink/polkadot-runtime-releaser/action/build@main + uses: hack-ink/polkadot-runtime-releaser/action/build@0.1.8 with: runtime: ${{ inputs.runtime }} features: ${{ inputs.features }} diff --git a/cli/src/cli/build.rs b/cli/src/cli/build.rs index d6529ec..f7d70c2 100644 --- a/cli/src/cli/build.rs +++ b/cli/src/cli/build.rs @@ -12,25 +12,43 @@ const WASM_EXT_COMPRESSED: &str = "compact.compressed.wasm"; #[derive(Debug, Parser)] pub struct BuildCmd { - /// The target runtime crate to build. + /// The target runtime to build. + /// /// This should be the name of the runtime crate in the file. - #[arg(value_name = "RUNTIME")] + #[arg(value_name = "RUNTIME", verbatim_doc_comment)] runtime: String, - /// The features to enable for the runtime crate. - #[arg(long, short, value_name = "FEATURES")] + /// The name to use matching the runtime artifacts. + /// This is useful when the runtime crate name is different from the runtime name. + /// + /// For example, `staging-kusama-runtime`. + /// With this option, you can specify the runtime name to be `kusama`, + /// and it will match the `kusama_runtime*.wasm` artifacts. + #[arg(long, short = 'n', value_name = "NAME", verbatim_doc_comment)] + override_runtime_name: Option, + /// The features to enable for the runtime. + #[arg(long, short, value_name = "FEATURES", verbatim_doc_comment)] features: Option, /// Whether to store the compressed runtime only. - #[arg(long)] + #[arg(long, verbatim_doc_comment)] no_compressed_only: bool, /// The toolchain version to use for the build; by default, it is set to . + /// /// This won't take effect if there is a file in the project directory, /// and that's the recommended way to specify the toolchain version. #[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.7"), conflicts_with = "override_docker_image")] + #[arg( + long, + short = 'v', + value_name = "VER", + default_value_t = String::from("0.1.8"), + verbatim_doc_comment, + 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. #[arg( long, @@ -41,23 +59,24 @@ pub struct BuildCmd { )] override_docker_image: Option, /// The polkadot-sdk-based project directory; by default, it is set to the current directory. - #[arg(long, short = 'd', value_name = "PATH")] + #[arg(long, short = 'd', value_name = "PATH", verbatim_doc_comment)] workdir: Option, /// The target directory of the cargo build. #[arg( long, short = 'o', value_name = "PATH", - default_value = "./polkadot-runtime-releaser-output" + default_value = "./polkadot-runtime-releaser-output", + verbatim_doc_comment )] output_dir: PathBuf, /// Whether to cache and use the output of the build. /// This is useful in local development. - #[arg(long)] + #[arg(long, verbatim_doc_comment)] cache_output: bool, /// Whether to cache and use the <$HOME/.cargo/registry> registry. /// This is useful in local development. - #[arg(long)] + #[arg(long, verbatim_doc_comment)] cache_registry: bool, } impl Run for BuildCmd { @@ -65,6 +84,7 @@ impl Run for BuildCmd { fn run(self) -> Result<()> { let Self { runtime, + override_runtime_name, features, no_compressed_only, toolchain_version, @@ -125,7 +145,11 @@ impl Run for BuildCmd { run_args.with_command(&cmd); run_args.run()?; - let snake_case_rt = runtime.replace("-runtime", "_runtime"); + let snake_case_rt = if let Some(name) = override_runtime_name { + format!("{name}_runtime") + } else { + runtime.replace("-runtime", "_runtime") + }; let output_rt = output_target_dir.join("release/wbuild").join(&runtime).join(&snake_case_rt); let compressed_wasm = output_rt.with_extension(WASM_EXT_COMPRESSED); diff --git a/cli/src/cli/inspect.rs b/cli/src/cli/inspect.rs index d3a2ca8..3ccbd10 100644 --- a/cli/src/cli/inspect.rs +++ b/cli/src/cli/inspect.rs @@ -10,13 +10,13 @@ use prr_lib::{hasher, runtime::Version, wasmer::Wasmer}; #[derive(Debug, Parser)] pub struct InspectCmd { /// Path to the WASM runtime. - #[arg(value_name = "PATH")] + #[arg(value_name = "PATH", verbatim_doc_comment)] path: PathBuf, /// Whether to check the runtime version in the `ParachainSystem::authorized_upgrade` call. - #[arg(long, default_value_t = true)] + #[arg(long, default_value_t = true, verbatim_doc_comment)] check_version: bool, /// Whether to print verbose output. - #[arg(short, long)] + #[arg(short, long, verbatim_doc_comment)] verbose: bool, } impl Run for InspectCmd { diff --git a/docker/Dockerfile b/docker/Dockerfile index 0758375..441e3e4 100644 --- a/docker/Dockerfile +++ b/docker/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.7" +LABEL version="0.1.8" RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \