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

Address dev branch toolchain issues. #149

Merged
merged 13 commits into from
Apr 19, 2024
Merged
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
21 changes: 14 additions & 7 deletions .github/workflows/ci-casper-client-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Get stable from rust-toolchain.toml
id: stable-toolchain
run: |
VER=$(sed -nr 's/channel\s+=\s+\"(.*)\"/\1/p' rust-toolchain.toml)
echo "RUST_CHANNEL=$VER" >> $GITHUB_ENV

- name: Install Toolchain - Stable
run: |
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
rustup component add --toolchain ${{ env.RUST_CHANNEL }} rustfmt rust-src clippy
rustup default ${{ env.RUST_CHANNEL }}
rustup target add wasm32-unknown-unknown
- name: Fmt
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -73,4 +79,5 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --lib --target wasm32-unknown-unknown --no-default-features
target: wasm32-unknown-unknown
args: --lib --target wasm32-unknown-unknown --no-default-features
9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ async-trait = { version = "0.1.74", optional = true }
base16 = "0.2.1"
casper-hashing = "3.0.0"
casper-types = { version = "4.0.1", features = ["std"] }
clap = { version = "4.4.10", optional = true, features = ["cargo", "deprecated", "wrap_help"] }
clap_complete = { version = "4.4.4", optional = true }
clap = { version = "~4.4", optional = true, features = ["cargo", "deprecated", "wrap_help"] }
clap_complete = { version = "<4.5.0", optional = true }
hex-buffer-serde = "0.4.0"
humantime = "2.1.0"
itertools = "0.12.0"
jsonrpc-lite = "0.6.0"
num-traits = "0.2.15"
once_cell = "1.18.0"
rand = "0.8.5"
reqwest = { version = "0.11.22", features = ["json"] }
reqwest = { version = "0.12.3", features = ["json"] }
schemars = "=0.8.5"
serde = { version = "1.0.193", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.108", features = ["preserve_order"] }
Expand All @@ -50,9 +50,6 @@ uint = "0.9.5"
[dev-dependencies]
tempfile = "3.8.1"

[build-dependencies]
vergen = { version = "7", default-features = false, features = ["git"] }

[patch.crates-io]
casper-hashing = { git = "https://github.com/casper-network/casper-node", branch = "dev" }
casper-types = { git = "https://github.com/casper-network/casper-node", branch = "dev" }
Expand Down
22 changes: 18 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
use vergen::{Config, ShaKind};
use std::process::Command;

const GIT_HASH_ENV_VAR: &str = "GIT_SHA_SHORT";

fn main() {
let mut config = Config::default();
*config.git_mut().sha_kind_mut() = ShaKind::Short;
let _ = vergen::vergen(config);
//Build command to retrieve the short git commit hash
let git_process_output = Command::new("git")
.arg("rev-parse")
.arg("--short")
.arg("HEAD")
.output()
.expect("Failed to retrieve short git commit hash");

//Parse the raw output into a string, we still need to remove the newline character
let git_hash_raw =
String::from_utf8(git_process_output.stdout).expect("Failed to convert git hash to string");
//Remove the newline character from the short git commit hash
let git_hash = git_hash_raw.trim_end_matches('\n');

println!("cargo:rustc-env={}={}", GIT_HASH_ENV_VAR, git_hash);
}
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.73.0"
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const APP_NAME: &str = "Casper client";

static VERSION: Lazy<String> =
Lazy::new(
|| match option_env!("VERGEN_GIT_SHA_SHORT").map(|sha| sha.to_lowercase()) {
|| match option_env!("GIT_SHA_SHORT").map(|sha| sha.to_lowercase()) {
None => crate_version!().to_string(),
Some(git_sha_short) => {
if git_sha_short.to_lowercase() == "unknown" {
Expand Down
Loading