Skip to content

Commit

Permalink
Merge pull request #2 from G-Core/update_wasmtime
Browse files Browse the repository at this point in the history
Update wasmtime to 20.0.2
  • Loading branch information
ruslanti authored May 14, 2024
2 parents d60a109 + 5fe4986 commit 9005c27
Show file tree
Hide file tree
Showing 31 changed files with 4,068 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output-type: html
137 changes: 137 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Continuous Integration

on: [ push ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Release build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features

- name: Install cargo-audit binary crate
uses: actions-rs/[email protected]
with:
crate: cargo-audit
version: latest
use-tool-cache: true

- name: Annotate commit with clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

- name: Security audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

coverage:
needs: build
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- uses: actions-rs/cargo@v1
name: Run test with code coverage report
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'

- id: coverage
name: Collect code coverage
uses: actions-rs/[email protected]

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ${{ steps.coverage.outputs.report }}

release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: coverage
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-wasi

- name: Run Release PR
uses: MarcoIeni/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

build-cli:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]

runs-on: ${{ matrix.os }}
needs: coverage
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Release build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --bin cli

- name: Upload target binary
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.os }}
path: target/release/cli
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sdk"]
path = sdk
url = [email protected]:G-Core/FastEdge-sdk-rust.git
59 changes: 59 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[workspace]
members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.3.7"
edition = "2021"
publish = false
authors = ["FastEdge Development Team"]

[workspace.dependencies]
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7", features = ["codec"] }
tracing = "0.1"
hyper = { version = "0.14", features = ["full"] }
http = "0.2.9"
async-trait = "0.1"
wasmtime = { version = "20.0" }
wasmtime-wasi = { version = "20.0" }
wasi-common = { version = "20.0" }
wasmtime-wasi-nn = { version = "20.0" }
clap = { version = "4", features = ["derive"] }
moka = { version = "0.12", features = ["sync"] }
smol_str = "0.2.1"
anyhow = "1.0"


[workspace.lints.rust]
unused_extern_crates = 'warn'
trivial_numeric_casts = 'warn'
unstable_features = 'warn'
unused_import_braces = 'warn'

[workspace.lints.clippy]
all = 'allow'

[package]
name = "cli"
version.workspace = true
edition.workspace = true
publish.workspace = true
authors.workspace = true


[dependencies]
anyhow = { workspace = true }
hyper = { workspace = true }
http = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
wasmtime = { workspace = true }
wasmtime-wasi = { workspace = true }
smol_str = { workspace = true }
clap = { version = "4.5.0", features = ["derive"] }
pretty_env_logger = "0.5.0"
runtime = { path = "crates/runtime", default-features = false }
http-service = { path = "crates/http-service" }
http-backend = { path = "crates/http-backend" }
hyper-tls = "0.5.0"
19 changes: 19 additions & 0 deletions crates/candle-wasi-nn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "candle-wasi-nn"
version.workspace = true
edition.workspace = true
publish.workspace = true
authors.workspace = true

[dependencies]
wasmtime-wasi-nn = { workspace = true }
tracing = { workspace = true }
candle-nn = "0.3"

[target.'cfg(target_os = "macos")'.dependencies]
candle-core = { version = "0.3", features = ["accelerate"] }
candle-transformers = { version = "0.3", features = ["accelerate"] }

[target.'cfg(not(target_os = "macos"))'.dependencies]
candle-core = { version = "0.3" }
candle-transformers = { version = "0.3" }
Loading

0 comments on commit 9005c27

Please sign in to comment.