enable circleci (#3)

This commit is contained in:
vms 2020-06-16 14:20:33 +03:00 committed by GitHub
parent 896f54f9fb
commit a85ac4ff14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 71 deletions

View File

@ -1,59 +1,80 @@
#version: 2.1 version: 2.1
#jobs: jobs:
# fce: fce:
# docker: docker:
# - image: circleci/rust:latest - image: circleci/rust:latest
# environment: environment:
# RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
# #RUST_TEST_THREADS: 1 #RUST_TEST_THREADS: 1
# steps: steps:
# - checkout - checkout
# - restore_cache: - restore_cache:
# keys: keys:
# - fce01-{{ checksum "fce/Cargo.toml" }} - fce01-{{ checksum "engine/Cargo.toml" }}-{{ checksum "fluence-faas/Cargo.toml" }}
# - run: | - run: |
# rustup toolchain install stable rustup toolchain install nightly
# rustup component add rustfmt rustup component add rustfmt
# rustup component add clippy rustup component add clippy --toolchain nightly
# cd fce
# cargo fmt --all -- --check --color always cd engine
# cargo build -v --all-features cargo fmt --all -- --check --color always
# cargo test -v --all-features cargo +nightly build -v --all-features
# cargo clippy -v cargo +nightly test -v --all-features
# - save_cache: cargo +nightly clippy -v
# paths:
# - ~/.cargo cd ../fluence-faas
# - ~/.rustup cargo fmt --all -- --check --color always
# key: fce01-{{ checksum "fce/Cargo.toml" }} cargo +nightly build -v --all-features
# wit_embedder: cargo +nightly test -v --all-features
# docker: cargo +nightly clippy -v
# - image: circleci/rust:latest
# environment: - save_cache:
# RUST_BACKTRACE: 1 paths:
# #RUST_TEST_THREADS: 1 - ~/.cargo
# steps: - ~/.rustup
# - checkout key: fce01-{{ checksum "engine/Cargo.toml" }}-{{ checksum "fluence-faas/Cargo.toml" }}
# - restore_cache:
# keys: examples:
# - wit_embedder01-{{ checksum "wit_embedder/Cargo.toml" }} docker:
# - run: | - image: circleci/rust:latest
# rustup toolchain install stable environment:
# rustup component add rustfmt RUST_BACKTRACE: 1
# rustup component add clippy #RUST_TEST_THREADS: 1
# cd wit_embedder steps:
# cargo fmt --all -- --check --color always - checkout
# cargo build -v --all-features - restore_cache:
# cargo test -v --all-features keys:
# cargo clippy -v - examples01-{{ checksum "examples/ipfs_node/wasm/ipfs_node/Cargo.toml" }}-{{ checksum "examples/ipfs_node/wasm/ipfs_rpc/Cargo.toml" }}-{{ checksum "examples/ipfs_node/Cargo.toml" }}
# - save_cache: - run: |
# paths: rustup toolchain install nightly
# - ~/.cargo rustup component add rustfmt
# - ~/.rustup rustup component add clippy
# key: wit_embedder01-{{ checksum "wit_embedder/Cargo.toml" }} cargo install cargo-wasi
#
#workflows: cd examples/ipfs_node/wasm/ipfs_node
# version: 2.1 cargo fmt --all -- --check --color always
# fce: cargo wasi build
# jobs: cargo clippy -v
# - fce
# - wit_embedder cd ../ipfs_rpc
cargo fmt --all -- --check --color always
cargo wasi build
cargo clippy -v
cd ../../../../tools/wit_embedder
cargo fmt --all -- --check --color always
cargo build -v --all-features
cargo clippy -v
- save_cache:
paths:
- ~/.cargo
- ~/.rustup
key: examples01-{{ checksum "examples/ipfs_node/wasm/ipfs_node/Cargo.toml" }}-{{ checksum "examples/ipfs_node/wasm/ipfs_rpc/Cargo.toml" }}-{{ checksum "examples/ipfs_node/Cargo.toml" }}
workflows:
version: 2.1
fce:
jobs:
- fce
- examples

5
.gitignore vendored
View File

@ -6,6 +6,9 @@ target/
*.wasm *.wasm
*.wat *.wat
# Allowed Wasm files for the example # Temporary file of ipfs node example
/examples/ipfs_node/wasm/artifacts/ipfs_rpc_file
# Allowed Wasm files for examples
!/examples/ipfs_node/wasm/artifacts/wasm_ipfs_rpc_wit.wasi.wasm !/examples/ipfs_node/wasm/artifacts/wasm_ipfs_rpc_wit.wasi.wasm
!/examples/ipfs_node/wasm/artifacts/wasm_modules/* !/examples/ipfs_node/wasm/artifacts/wasm_modules/*

View File

@ -41,7 +41,11 @@ fn main() {
println!("ipfs node addresses are:\n{:?}", node_addresses); println!("ipfs node addresses are:\n{:?}", node_addresses);
let result = ipfs_node let result = ipfs_node
.call_code(&ipfs_rpc, "put", &[IValue::String("Hello, world".to_string())]) .call_code(
&ipfs_rpc,
"put",
&[IValue::String("Hello, world".to_string())],
)
.unwrap(); .unwrap();
println!("execution result {:?}", result); println!("execution result {:?}", result);

View File

@ -26,11 +26,10 @@ use crate::path::to_full_path;
const RESULT_FILE_PATH: &str = "/tmp/ipfs_rpc_file"; const RESULT_FILE_PATH: &str = "/tmp/ipfs_rpc_file";
pub fn main() { pub fn main() {
let env_variable = std::env::var("tmp").unwrap(); let msg = "ipfs_node.main: WASI initialization finished, env {}";
println!( unsafe {
"ipfs_node.main: WASI initialization finished, env {}", log_utf8_string(msg.as_ptr() as _, msg.len() as _);
env_variable }
);
} }
#[no_mangle] #[no_mangle]

View File

@ -25,7 +25,10 @@ use std::path::PathBuf;
const RPC_TMP_FILEPATH: &str = "/tmp/ipfs_rpc_file"; const RPC_TMP_FILEPATH: &str = "/tmp/ipfs_rpc_file";
pub fn main() { pub fn main() {
println!("ipfs_rpc.main: WASI initialization finished"); let msg = "ipfs_rpc.main: WASI initialization finished, env {}";
unsafe {
log_utf8_string(msg.as_ptr() as _, msg.len() as _);
}
} }
#[no_mangle] #[no_mangle]

View File

@ -27,7 +27,7 @@ pub enum FaaSError {
/// Various errors related to file i/o. /// Various errors related to file i/o.
IOError(String), IOError(String),
/// WIT doesn't contain such type. /// FCE errors.
EngineError(FCEError), EngineError(FCEError),
} }

View File

@ -103,9 +103,7 @@ where
} }
/// Make FCE config based on parsed raw config. /// Make FCE config based on parsed raw config.
pub(crate) fn make_fce_config( pub(crate) fn make_fce_config(config: Option<ModuleConfig>) -> Result<FCEModuleConfig, FaaSError> {
config: Option<ModuleConfig>,
) -> Result<FCEModuleConfig, FaaSError> {
use super::imports::create_host_import_func; use super::imports::create_host_import_func;
use super::imports::log_utf8_string; use super::imports::log_utf8_string;
use wasmer_core::import::Namespace; use wasmer_core::import::Namespace;