Skip to content

Commit 30e4ac1

Browse files
authored
feat(rust): code coverage (#36)
2 parents 7fa51e2 + 99140dd commit 30e4ac1

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
with:
2828
save-if: ${{ github.ref == 'refs/heads/master' }}
2929
cache-all-crates: true
30+
- uses: taiki-e/install-action@cargo-llvm-cov
3031

3132
- name: Install devenv.sh
3233
run: nix profile install nixpkgs#devenv

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
[workspace]
22
resolver = "3"
33
members = [
4+
".",
45
"tests/runner",
56
"tests/wasm/[a-z]*",
67
]
8+
default-members = [
9+
".",
10+
"tests/runner",
11+
]
712

813
[package]
914
name = "wasm-trampoline"

devenv.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
"wasm32-wasip2"
2424
"wasm32v1-none"
2525
];
26+
components = [
27+
"cargo"
28+
"clippy"
29+
"clippy-preview"
30+
"rust-analyzer"
31+
"rustc"
32+
"rustfmt"
33+
"llvm-tools-preview"
34+
];
2635
};
2736

2837
processes = lib.optionalAttrs (!config.devenv.isTesting) {
@@ -35,6 +44,7 @@
3544
cargo build --workspace --target wasm32-wasip2
3645
cargo fmt --check --all
3746
tests/runner/build.sh
47+
cargo llvm-cov run --bin runner -p runner --release
3848
'';
3949

4050
git-hooks.hooks.nixfmt-rfc-style.enable = true;

tests/wasm/.cargo/config.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[build]
2-
target = ["wasm32-unknown-unknown"]
2+
target = ["wasm32-unknown-unknown", "wasm32-wasip2"]
33

44
[target.wasm32-wasip2]
55
runner = "wasmtime"
6+
[target.wasm32-unknown-unknown]
7+
runner = "wasmtime"
68

79
[profile.dev]
810
panic = "abort"

0 commit comments

Comments
 (0)