Skip to content

add playground online check #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
pull_request:
branches:
- "*"


jobs:
build:
strategy:
Expand Down Expand Up @@ -45,6 +43,18 @@ jobs:
override: true
- name: Build on nightly
run: cargo build --release

# wasm check
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: latest
- name: Setup wasm-pack
run: |
cargo b
wasm-pack build --target bundler
wasm-pack build --target web
working-directory: ./playground/wasm

test:
strategy:
matrix:
Expand Down
12 changes: 12 additions & 0 deletions playground/wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "wasm"
version = "0.1.0"
edition = "2021"


[lib]
crate-type = ["cdylib", "rlib"]


[dependencies]
duration-str = { path = "../../"}
14 changes: 14 additions & 0 deletions playground/wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
Loading