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

View File

@ -41,7 +41,11 @@ fn main() {
println!("ipfs node addresses are:\n{:?}", node_addresses);
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();
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";
pub fn main() {
let env_variable = std::env::var("tmp").unwrap();
println!(
"ipfs_node.main: WASI initialization finished, env {}",
env_variable
);
let msg = "ipfs_node.main: WASI initialization finished, env {}";
unsafe {
log_utf8_string(msg.as_ptr() as _, msg.len() as _);
}
}
#[no_mangle]

View File

@ -25,7 +25,10 @@ use std::path::PathBuf;
const RPC_TMP_FILEPATH: &str = "/tmp/ipfs_rpc_file";
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]

View File

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

View File

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