Skip to content

Commit

Permalink
feat(crates-io): introduce crates-io manager (#3103)
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop authored Nov 17, 2023
1 parent 84cd09d commit 487252d
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 41 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/crates-io.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Crates IO

on:
workflow_dispatch:

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color

jobs:
publish:
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v3

- name: "Install: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1

- name: "Publish packages"
run: cargo run --release -p crates-io-manager
88 changes: 82 additions & 6 deletions Cargo.lock

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

14 changes: 12 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ members = [
"gclient",
"gcore",
"gmeta",
"gmeta/codegen",
"gsdk",
"gsdk/codegen",
"gsdk/api-gen",
Expand All @@ -98,6 +99,8 @@ base64 = "0.21.5"
byteorder = { version = "1.5.0", default-features = false }
blake2-rfc = { version = "0.2.18", default-features = false }
bs58 = { version = "0.5.0", default-features = false }
# TODO: upgrade this package ( issue #2694 )
cargo_metadata = "=0.15.3"
clap = { version = "4.4.8" }
codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false }
color-eyre = "0.6.2"
Expand All @@ -109,6 +112,7 @@ dlmalloc = { git = "https://github.com/gear-tech/dlmalloc-rust.git" }
dyn-clonable = "0.9.0"
enum-iterator = "1.4.0"
env_logger = "0.10"
environmental = "1.1.3"
futures = { version = "0.3", default-features = false }
futures-timer = "3.0.2"
futures-util = "0.3.29"
Expand Down Expand Up @@ -163,11 +167,15 @@ tokio = { version = "1.34.0" }
url = "2.4.1"
wat = "1.0.79"
wabt = "0.10.0"
wasmer = "2.2"
wasmer-cache = "2.2.1"
wasmer-types = "2.2"
wasmi = { version = "0.14.0", default-features = false }
wasmparser = { package = "wasmparser-nostd", version = "0.100.1", default-features = false }
which = "4.4.0"
winapi = "0.3.9"
paste = "1.0"
tempfile = "3.5.0"

# Published deps
#
Expand All @@ -194,6 +202,7 @@ gstd = { path = "gstd" }
gsys = { path = "gsys" }
gtest = { path = "gtest" }
gmeta = { path = "gmeta" }
gmeta-codegen = { path = "gmeta/codegen" }
gear-authorship = { path = "node/authorship" }
gear-core-backend = { path = "core-backend", default-features = false }
gear-call-gen = { path = "utils/call-gen" }
Expand Down Expand Up @@ -422,8 +431,6 @@ demo-wat = { path = "examples/wat" }
cfg-if = "1.0.0" # gear-lazy-pages
errno = "0.3" # gear-lazy-pages
nix = "0.26.4" # gear-lazy-pages
# TODO: upgrade this package ( issue #2694 )
cargo_metadata = "=0.15.3" # utils/wasm-builder
impl-trait-for-tuples = "0.2.2" # pallets/staking-rewards
indexmap = "2.1.0" # utils/weight-diff
indicatif = "*" # utils/wasm-gen
Expand Down Expand Up @@ -453,6 +460,9 @@ fail = "0.5" # gear
scale-value = "^0.12" # gsdk
heck = "0.4.1" # gsdk-api-gen
etc = "0.1.16" # gcli
cargo_toml = "0.15.3" # crates-io
crates-io = "0.37.0" # crates-io
curl = "0.4.44" # crates-io
scale-decode = "0.9.0" # gsdk
directories = "5.0.1" # utils/key-finder
num-traits = { version = "0.2", default-features = false } # gear-core
Expand Down
3 changes: 1 addition & 2 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ use gear_core::{
};
use primitive_types::H256;
use sp_arithmetic::traits::{BaseArithmetic, One, Saturating, UniqueSaturatedInto, Unsigned};
use sp_core::crypto::UncheckedFrom;
use sp_std::{
collections::{btree_map::BTreeMap, btree_set::BTreeSet},
prelude::*,
Expand Down Expand Up @@ -108,7 +107,7 @@ impl Origin for sp_runtime::AccountId32 {
}

fn from_origin(v: H256) -> Self {
sp_runtime::AccountId32::unchecked_from(v)
Self::new(v.0)
}
}

Expand Down
2 changes: 0 additions & 2 deletions gcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ clap = { workspace = true, features = ["derive"] }
thiserror.workspace = true
tokio = { workspace = true, features = [ "full" ] }
whoami.workspace = true
core-processor = { workspace = true, features = [ "std" ] }
gear-lazy-pages-interface = { workspace = true, features = [ "std" ] }
reqwest = { workspace = true, default-features = false, features = [ "json", "rustls-tls" ] }
etc.workspace = true
sp-io = { workspace = true, features = [ "std" ] }
Expand Down
1 change: 0 additions & 1 deletion gcli/src/cmd/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ impl Program {
Ok(())
}

/// Display meta.
fn meta(path: &PathBuf, name: &Option<String>) -> Result<()> {
let ext = path
.extension()
Expand Down
6 changes: 0 additions & 6 deletions gcli/src/meta/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use anyhow::{anyhow, Result};
use wasmi::{AsContextMut, Engine, Extern, Linker, Memory, MemoryType, Module, Store};

const PAGE_STORAGE_PREFIX: [u8; 32] = *b"gcligcligcligcligcligcligcligcli";

/// HostState for the WASM executor
#[derive(Default)]
pub struct HostState {
Expand All @@ -39,10 +37,6 @@ pub fn call_metadata(wasm: &[u8]) -> Result<Vec<u8>> {

/// Executes the WASM code.
fn execute(wasm: &[u8], method: &str) -> Result<Vec<u8>> {
assert!(gear_lazy_pages_interface::try_to_enable_lazy_pages(
PAGE_STORAGE_PREFIX
));

let engine = Engine::default();
let module = Module::new(&engine, wasm).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion gmeta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository.workspace = true
scale-info.workspace = true
blake2-rfc.workspace = true
hex = { workspace = true, features = ["alloc"] }
gmeta-codegen = { path = "codegen", optional = true }
gmeta-codegen = { workspace = true, optional = true }
derive_more.workspace = true

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion gsdk/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ repository.workspace = true
proc-macro = true

[dependencies]
syn = { workspace = true, features = ["full"] }
syn = { workspace = true, features = ["default", "full"] }
quote.workspace = true
proc-macro2.workspace = true
12 changes: 6 additions & 6 deletions sandbox/env/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "gear-sandbox-env"
version = "0.1.0"
authors = ["Gear Technologies"]
edition = "2021"
license = "GPL-3.0"
homepage = "https://gear-tech.io"
repository = "https://github.com/gear-tech/gear"
description = "This crate provides means to instantiate and execute wasm modules."
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
version.workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
20 changes: 10 additions & 10 deletions sandbox/host/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[package]
name = "gear-sandbox-host"
version = "0.1.0"
authors = ["Gear Technologies"]
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
homepage = "https://gear-tech.io"
repository = "https://github.com/gear-tech/gear"
description = "A set of common definitions that are needed for defining execution engines."
readme = "README.md"
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
version.workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { workspace = true, features = ["std"] }
environmental = "1.1.3"
environmental.workspace = true
thiserror.workspace = true
log = { workspace = true, features = ["std"] }
sandbox-wasmer.workspace = true
Expand All @@ -23,9 +23,9 @@ wasmi = { git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext
sp-allocator = { workspace = true, features = ["std"] }
sp-wasm-interface = { workspace = true, features = ["std"] }
gear-sandbox-env = { workspace = true, features = ["std"] }
wasmer-cache = { version = "2.2.1", optional = true }
once_cell = "1.17.1"
tempfile = "3.5.0"
wasmer-cache = { workspace = true, optional = true }
once_cell.workspace = true
tempfile.workspace = true

[features]
default = ["wasmer-cache"]
9 changes: 7 additions & 2 deletions utils/actor-system-error/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
name = "actor-system-error"
version = "0.1.0"
edition = "2021"
description = "Helper crate for implementation of errors on gear backend"
edition.workspace = true
version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

[dependencies]
derive_more.workspace = true
Loading

0 comments on commit 487252d

Please sign in to comment.