Skip to content

Commit

Permalink
setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gfusee committed Nov 7, 2023
1 parent e14c1a7 commit 8753b3c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
- name: Switch to Rust nightly
run: rustup default nightly
- name: Build
run: cargo build
run: cargo build --features ci
- name: Run tests
run: cargo test
run: cargo test --features ci
- name: Install cargo-release
run: cargo install cargo-release
run: cargo install cargo-release --no-verify
- name: Publish crate
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions abi-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ description = "A build-dependency crate for 'nova' which hosts macros and utilit
license = "GPL-3.0-only"
repository = "https://github.com/gfusee/novax"

[features]
no-fmt-output = []

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
12 changes: 6 additions & 6 deletions abi-build/src/generator/impl_abi_mod.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use rust_format::{Formatter, RustFmt};
use crate::abi::result::Abi;
use crate::errors::build_error::BuildError;
use crate::generator::generated_file::GeneratedFile;
use crate::generator::generator_error::GeneratorError;
use crate::generator::impl_abi_types::impl_abi_types_mod;
use crate::generator::impl_contract::impl_contract;

pub fn generate_from_abi(abi: &Abi) -> Result<GeneratedFile, BuildError> {
let Ok(formatted_content) = RustFmt::default().format_str(impl_mod(abi)?.to_string()) else {
println!("{:?}", RustFmt::default().format_str(impl_mod(abi)?.to_string()).unwrap_err());
return Err(GeneratorError::UnableToFormatRustCode.into())
let content = impl_mod(abi)?.to_string();

#[cfg(not(feature = "no-fmt-output"))]
let Ok(content) = rust_format::Formatter::format_str(&rust_format::RustFmt::default(), content) else {
return Err(crate::generator::generator_error::GeneratorError::UnableToFormatRustCode.into())
};

Ok(
GeneratedFile {
file_name: abi.get_mod_name() + ".rs",
mod_name: abi.get_mod_name(),
file_content: formatted_content
file_content: content
}
)
}
Expand Down
6 changes: 0 additions & 6 deletions abi-build/src/generator/impl_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,6 @@ fn get_managed_type_for_abi_type(abi_type_name: &str, abi_types: &AbiTypes, api_
quote! {#managed_type_ident}
)
} else {
let test = parse_abi_type_name_to_managed_ident(
abi_type_name,
abi_types,
api_generic
)?;

if abi_type_name.starts_with("multi") {
panic!("bouhhh");
}
Expand Down
3 changes: 3 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ repository = "https://github.com/gfusee/novax"
categories = ["cryptography::cryptocurrencies", "api-bindings"]
keywords = ["multiversx", "blockchain", "sdk", "api"]

[features]
ci = ["novax-abi-build/no-fmt-output"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down

0 comments on commit 8753b3c

Please sign in to comment.