Skip to content

Commit

Permalink
Release v0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Dec 25, 2024
1 parent 3941171 commit ce4e71f
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 41 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
[
{ name: aarch64-apple-darwin, os: macos-latest },
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
{ name: x86_64-pc-windows-msvc, os: windows-latest },
]
steps:
- name: Fetch latest code
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
[
{ name: aarch64-apple-darwin, os: macos-latest },
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
{ name: x86_64-pc-windows-msvc, os: windows-latest },
]
steps:
- name: Fetch latest code
Expand Down
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6"
version = "0.1.7"

[workspace.dependencies]
# crates.io
Expand Down Expand Up @@ -40,6 +40,7 @@ tokio = { version = "1.42" }
toml = { version = "0.8" }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3" }
users = { version = "0.11" }
vergen-gitcl = { version = "1.0" }
# self
prr-lib = { version = "0.1", package = "polkadot-runtime-releaser-lib", path = "lib" }
Expand Down
28 changes: 0 additions & 28 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion action/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6/prr-x86_64-unknown-linux-gnu.tar.gz |
-L https://github.com/hack-ink/polkadot-runtime-releaser/releases/download/v0.1.7/prr-x86_64-unknown-linux-gnu.tar.gz |
tar xz &&
chmod u+x prr &&
mv prr /usr/local/bin/prr
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
users = { workspace = true }
# self
prr-lib = { workspace = true }
12 changes: 6 additions & 6 deletions cli/src/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct BuildCmd {
#[arg(long, short, value_name = "VER", verbatim_doc_comment)]
toolchain_version: Option<String>,
/// Image version of the <ghcr.io/hack-ink/polkadot-runtime-releaser>.
#[arg(long, short = 'v', value_name = "VER", default_value_t = String::from("0.1.6"), conflicts_with = "override_docker_image")]
#[arg(long, short = 'v', value_name = "VER", default_value_t = String::from("0.1.7"), 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.
Expand Down Expand Up @@ -92,7 +92,9 @@ impl Run for BuildCmd {
format!("/{}", output_dir.file_name().expect("dir must exist").to_string_lossy());
let mut run_args = RunArgs::new(image_version, override_docker_image);

run_args.with_env("CARGO_TARGET_DIR", &format!("{container_output_dir}/target"));
run_args.with_env("HOST_UID", users::get_current_uid());
run_args.with_env("HOST_GID", users::get_current_gid());
run_args.with_env("CARGO_TARGET_DIR", format!("{container_output_dir}/target"));
run_args.with_volume(&workdir.to_string_lossy(), "/workdir");
run_args.with_volume(&output_dir.to_string_lossy(), &container_output_dir);

Expand Down Expand Up @@ -125,7 +127,7 @@ impl Run for BuildCmd {

let snake_case_rt = runtime.replace("-runtime", "_runtime");
let output_rt =
output_dir.join("target/release/wbuild").join(&runtime).join(&snake_case_rt);
output_target_dir.join("release/wbuild").join(&runtime).join(&snake_case_rt);
let compressed_wasm = output_rt.with_extension(WASM_EXT_COMPRESSED);
let ver = Wasmer::load(&compressed_wasm)?.runtime_version(true)?.spec_version;
let rt_name = format!("{snake_case_rt}-{ver}");
Expand All @@ -148,9 +150,7 @@ impl Run for BuildCmd {
output_target_dir.display()
);

if let Err(e) = fs::remove_dir_all(&output_target_dir) {
tracing::error!("failed to clean up the output target directory, due to {e}");
}
fs::remove_dir_all(&output_target_dir)?;
}

Ok(())
Expand Down
34 changes: 34 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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"

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang \
cmake \
curl \
git \
libssl-dev \
pkg-config \
protobuf-compiler \
rustup \
gosu \
&& rm -rf /var/lib/apt/lists/*

ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
ENV CARGO_TERM_COLOR=always
ENV RUST_BACKTRACE=full
ENV WASM_BUILD_WORKSPACE_HINT=/workdir

WORKDIR /workdir

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

CMD ["/bin/bash"]
20 changes: 20 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -Eeuo pipefail

DEFAULT_UID=1000
DEFAULT_GID=1000

HOST_UID="${HOST_UID:-}"
HOST_GID="${HOST_GID:-}"

if [ -z "$HOST_UID" ] || [ -z "$HOST_GID" ]; then
echo "HOST_UID/HOST_GID are not set. Running as root."
exec "$@"
else
echo "Running as UID=${HOST_UID}, GID=${HOST_GID}."

groupadd -g "$HOST_GID" builder
useradd -m -u "$HOST_UID" -g "$HOST_GID" builder

exec gosu builder "$@"
fi
7 changes: 6 additions & 1 deletion lib/src/docker.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Polkadot Runtime Releaser Docker component.
// std
use std::fmt::Display;
// crates.io
use atty::Stream;
// self
Expand Down Expand Up @@ -29,7 +31,10 @@ impl<'a> RunArgs<'a> {
}

/// Set the environment variable.
pub fn with_env(&mut self, key: &str, value: &str) {
pub fn with_env<T>(&mut self, key: &str, value: T)
where
T: Display,
{
self.envs.push(format!("{key}={value}"));
}

Expand Down

0 comments on commit ce4e71f

Please sign in to comment.