Skip to content

Commit

Permalink
chore: Add example echo config file and readme for composer v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaykumargdr committed Dec 27, 2023
1 parent d39fa3c commit 52d1441
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 0 deletions.
81 changes: 81 additions & 0 deletions workflow/composer-v2/example/main.echo
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
attributes = {
"api_host": "https://65.20.70.146:31001",
"auth_key": "23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP",
"insecure": "true",
"namespace": "guest",
}

cartype = task(
kind = "openwhisk",
action_name = "cartype",
input_arguments = [
argument(
name="car_type",
input_type = String
),
],
attributes = attributes
)

modelavail = task(
kind = "openwhisk",
action_name = "modelavail",
input_arguments = [
argument(
name="car_company_list",
input_type = HashMap(String, List(String))
),
argument(
name="company_name",
input_type= String
)
],
attributes = attributes,
depend_on = [
depend(task_name = "cartype", cur_field = "car_company_list", prev_field = "car_company_list")
]
)

modelprice = task(
kind = "openwhisk",
action_name = "modelsprice",
input_arguments = [
argument(
name="models",
input_type= List(String)
),
],
attributes = attributes,
depend_on = [
depend(task_name = "modelavail", cur_field = "models", prev_field = "models")
]
)

purchase = task(
kind = "openwhisk",
action_name = "purchase",
input_arguments = [
argument(
name="model_price_list",
input_type = HashMap(String, Int)
),
argument(
name="model_name",
input_type= String
),
argument(
name="price",
input_type= Int
),
],
attributes = attributes,
depend_on = [
depend(task_name = "modelsprice", cur_field = "model_price_list", prev_field = "model_price_list")
]
)

workflows(
name = "car_market_place",
version = "0.0.1",
tasks = [cartype, modelavail, modelprice, purchase]
)
84 changes: 84 additions & 0 deletions workflow/composer-v2/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Composer-v2

[![License: Apache-2.0](https://img.shields.io/github/license/icon-project/IBC-Integration.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0)

## Introduction

The Composer is an integrated software package, encompassing both the Echo Library and Echo CLI components. This comprehensive solution is specifically tailored to streamline the process of generating WebAssembly (Wasm) files. The Echo Library serves as a foundational building block, offering a rich set of functionalities, while the Echo CLI excels in orchestrating the creation of Wasm files based on a specified list of configuration files. This sophisticated combination empowers developers by providing a seamless and organized approach to translating configuration parameters into fully functional web applications, enhancing the overall development experience.

The Echo-Library and Echo-Cli tandem empower developers with a comprehensive solution for defining, managing, and executing workflows with ease. By harnessing Rust's capabilities, these tools provide a solid foundation for creating efficient and optimized WebAssembly files, offering developers a versatile toolkit to streamline their development processes.

## Prerequisite

- Ensure [Rust](https://www.rust-lang.org/tools/install) is installed and updated to the latest version.

## Getting started

- Clone the repository

```
git clone https://github.com/HugoByte/internal-research-and-sample-code.git
```

- change the directory to `composer-dev`

- Installing the build-libraries

```
brew install llvm@11
```

```
export CC=/opt/homebrew/Cellar/llvm@11/11.1.0_4/bin/clang-11 && export AR=/opt/homebrew/Cellar/llvm@11/11.1.0_4/bin/llvm-ar
```
*Note: This is required only for polkadot*

- Installing the echo-library

```
cargo install --path package
```

- Run

```
composer
```

## Usage

- Building the current package

```
composer build
```

- Validating the config file

```
composer validate
```

- Creating the new Package

```
composer create <package_name>
```

## Example

- Validating the config file

```
composer validate ./example
```
- Build the config file
```
composer build ./example -o ./example
```
## License
Licensed under [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)

0 comments on commit 52d1441

Please sign in to comment.