-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mrml-wasm): create wasm package (#312)
* feat(wasm-pack): create package Signed-off-by: Jérémie Drouet <[email protected]> * feat(mrml-wasm): implement engine with toHtml function Signed-off-by: Jérémie Drouet <[email protected]> * ci(mrml-wasm): create workflow Signed-off-by: Jérémie Drouet <[email protected]> --------- Signed-off-by: Jérémie Drouet <[email protected]>
- Loading branch information
Showing
11 changed files
with
494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
on: | ||
push: | ||
paths: | ||
- .github/workflows/mrml-wasm-* | ||
- packages/mrml-wasm/** | ||
- packages/mrml-core/** | ||
- Cargo.lock | ||
- Cargo.toml | ||
|
||
defaults: | ||
run: | ||
working-directory: packages/mrml-wasm | ||
|
||
env: | ||
RUSTFLAGS: "-Dwarnings" | ||
|
||
jobs: | ||
code-checking: | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ github.ref }}-mrml-wasm-code-checking | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
components: rustfmt,clippy | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-mrml-wasm-code-checking-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: run lint | ||
run: cargo fmt --check | ||
|
||
- name: run check | ||
run: cargo check --all-features --tests | ||
|
||
- name: run clippy | ||
run: cargo clippy --all-targets --all-features --tests | ||
|
||
testing: | ||
runs-on: ubuntu-latest | ||
container: rust:1-bullseye | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-mrml-wasm-testing | ||
cancel-in-progress: true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
|
||
- name: install wasm-pack | ||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-mrml-wasm-testing-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: run unit tests | ||
run: cargo test | ||
|
||
- name: run integration tests | ||
run: wasm-pack test --node |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
bin/ | ||
pkg/ | ||
wasm-pack.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[package] | ||
name = "mrml-wasm" | ||
version = "0.1.0" | ||
authors = ["Jérémie Drouet <[email protected]>"] | ||
edition = "2018" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
default = ["console_error_panic_hook"] | ||
|
||
[dependencies] | ||
# The `console_error_panic_hook` crate provides better debugging of panics by | ||
# logging them with `console.error`. This is great for development, but requires | ||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for | ||
# code size when deploying. | ||
console_error_panic_hook = { version = "0.1.7", optional = true } | ||
|
||
mrml = { version = "2.0.0-rc3", path = "../mrml-core", default-features = false, features = [ | ||
"parse", | ||
"render", | ||
] } | ||
|
||
serde = { version = "1.0", features = ["derive"] } | ||
serde-wasm-bindgen = { version = "0.5" } | ||
|
||
# to generate typescript binding | ||
tsify = { version = "0.4" } | ||
|
||
wasm-bindgen = { version = "0.2" } | ||
|
||
[dev-dependencies] | ||
wasm-bindgen-test = "0.3.34" | ||
|
||
[profile.release] | ||
# Tell `rustc` to optimize for small code size. | ||
opt-level = "s" |
Oops, something went wrong.