Skip to content

Commit

Permalink
feat: use edgee-component toml to build (#4)
Browse files Browse the repository at this point in the history
* feat: use edgee-component toml to build

* feat: change workflow to have a normal build

* feat: update wit version

* feat: harmonize component output path

* feat(): update toml for new format
  • Loading branch information
NicolasGirardot authored Feb 11, 2025
1 parent 901b574 commit 4323ae7
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 54 deletions.
106 changes: 53 additions & 53 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
name: Check
on:
push:
branches:
- main
pull_request:
push:
branches:
- main
pull_request:

jobs:
check:
name: cargo check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-wasip2 # WebAssembly target
components: rustfmt
- run: cargo check
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- uses: actions-rust-lang/rustfmt@v1
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- uses: wearerequired/lint-action@master
with:
clippy: true
build:
name: cargo build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-wasip2 # WebAssembly target
- run: make build
check:
name: cargo check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-wasip2 # WebAssembly target
components: rustfmt
- run: cargo check
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- uses: actions-rust-lang/rustfmt@v1
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- uses: wearerequired/lint-action@master
with:
clippy: true
build:
name: cargo build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-wasip2 # WebAssembly target
- run: make build-no-edgee

test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@cargo-llvm-cov
- run: make test.coverage
test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@cargo-llvm-cov
- run: make test.coverage
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ help:
| awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }'

build: ## Build the wasi component
edgee components build

build-no-edgee: ## Build the wasi component
cargo build --target wasm32-wasip2 --release
cp ./target/wasm32-wasip2/release/example_rs_component.wasm dc_component.wasm

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ This is an example of a Rust Edgee Component.
Requirements:
- cargo
- wit-deps
- [edgee-cli] (https://github.com/edgee-cloud/edgee)

## Building

```shell
$ make build
```
```
16 changes: 16 additions & 0 deletions edgee-component.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
manifest_version = 1

[package]
name = "example-rust-component"
version = "1.0.0"

category = "data-collection"
subcategory = "analytics"
description = "Example Rust component for data collection"
documentation = "https://github.com/edgee-cloud/example-rust-component"
repository = "https://github.com/edgee-cloud/example-rust-component"
wit-world-version = "0.4.0"

[package.build]
command = "cargo build --target wasm32-wasip2 --release --target-dir ./target && mv ./target/wasm32-wasip2/release/example_rust_component.wasm ./dc_component.wasm"
output_path = "dc_component.wasm"

0 comments on commit 4323ae7

Please sign in to comment.