Skip to content
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

Improve CI for wasmer_wamr feature #116

Merged
merged 62 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c67bc39
log
mattyg Aug 29, 2024
368a8e2
ci: windows tests run both wasmer_wamr & wasmer_sys feature flags as …
mattyg Aug 30, 2024
2eb5669
chore: delete unused circle ci workflow
mattyg Aug 30, 2024
202eb30
fix: bench with wasmer_wamr feature
mattyg Aug 30, 2024
ef93147
refactor: split up testing scripts by wasmer feature
mattyg Aug 30, 2024
1cb1ba7
ci: split up ci jobs by wasmer feature, test both wasmer features in …
mattyg Aug 30, 2024
f39f46c
doc: clarifying comment
mattyg Aug 30, 2024
ac0cb24
ci: yaml syntax
mattyg Aug 30, 2024
7da05db
fix: scripts path changed
mattyg Aug 30, 2024
f1f6960
fix: rm windows target
mattyg Aug 30, 2024
e8e1d7b
fix: include error_as_host feature, only run static tests once
mattyg Aug 30, 2024
e4994bb
ci: cancel previous superceeded jobs
mattyg Aug 30, 2024
3a2c0e9
fix: remove feature
mattyg Aug 30, 2024
63d9dd5
fix: missing error_as_host feature
mattyg Aug 30, 2024
44a8af5
wip: switch to hc-wasmer fork with win32 fix
mattyg Aug 30, 2024
4fddfc3
wip: only test win32 wasmer_wamr
mattyg Aug 30, 2024
bd0cec3
wip: try to get windows building in ci
mattyg Aug 30, 2024
3494a1a
build: bump hc-wasmer
mattyg Aug 30, 2024
57315e0
wip: try mingw instead
mattyg Aug 30, 2024
5ee2e5d
wip: install newer cmake
mattyg Aug 30, 2024
9052f8a
wip: try msys
mattyg Aug 30, 2024
5d4b7ef
wip: try msys2
mattyg Aug 30, 2024
07d12b4
build: bump cargo lock
mattyg Aug 30, 2024
9e1a670
build: bump cargo lock
mattyg Aug 30, 2024
921e7cf
build: bump cargo lock
mattyg Aug 30, 2024
936089c
build: bump cargo lock
mattyg Aug 30, 2024
39d9653
build: bump cargo lock
mattyg Aug 30, 2024
7bd6b19
build: bump cargo lock
mattyg Aug 30, 2024
0e76b8e
build: bump cargo lock
mattyg Aug 30, 2024
5dac331
build: bump cargo lock
mattyg Aug 30, 2024
01cddc7
build: bump cargo lock
mattyg Aug 31, 2024
d8211d8
build: bump cargo lock
mattyg Aug 31, 2024
4b47005
wip
mattyg Aug 31, 2024
376dcf8
wip
mattyg Aug 31, 2024
335e994
fix: setup-scoop fork to allow app names with dashes
mattyg Aug 31, 2024
78d3b9c
fix: delete command processor autorun reg entry
mattyg Aug 31, 2024
fa80b89
fix: syntax
mattyg Aug 31, 2024
30b4b3f
wip
mattyg Aug 31, 2024
5aea0ba
wip
mattyg Aug 31, 2024
7d52f17
wip
mattyg Aug 31, 2024
90735f5
wip
mattyg Aug 31, 2024
3bf4dbe
wip
mattyg Aug 31, 2024
85eacf3
wip
mattyg Aug 31, 2024
cdba5b5
wip
mattyg Aug 31, 2024
03d570f
wip
mattyg Aug 31, 2024
9204bfe
wip
mattyg Aug 31, 2024
47cdd4f
wip
mattyg Aug 31, 2024
9094d37
wip
mattyg Aug 31, 2024
a8af8f9
wip: try ucrt
mattyg Aug 31, 2024
6dfcc86
wip
mattyg Aug 31, 2024
73e1aba
wip
mattyg Aug 31, 2024
aa46052
wip
mattyg Aug 31, 2024
c5cc0f7
fix: bump wamr
mattyg Aug 31, 2024
8d497c7
ci: pause work on attempting windows build with wasmer_wamr feature, …
mattyg Sep 1, 2024
782990b
fix: typo
mattyg Sep 1, 2024
2ae1eda
fix: invalid flag
mattyg Sep 1, 2024
4d8277b
chore: cleanup
mattyg Sep 1, 2024
4c1a0c8
ci: try to resolve ubuntu ci being cancelled - maybe its out of memory?
mattyg Sep 1, 2024
69ba4a7
fix: syntax
mattyg Sep 1, 2024
94c8ab2
fix: moar swap space
mattyg Sep 1, 2024
e0f1780
ci: only run bench on ubuntu
mattyg Sep 11, 2024
cd985e0
fix: workflow concurrency group should be only for that pr
mattyg Sep 11, 2024
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
33 changes: 0 additions & 33 deletions .circleci/config.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not being used anymore and appears years outdated.

This file was deleted.

21 changes: 19 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ jobs:
strategy:
fail-fast: false
matrix:
script: ["./test.sh", "./bench.sh"]
script: ["test", "bench"]
os: ["ubuntu-latest", "macos-latest"]
wasmer-feature: ["wasmer_sys", "wasmer_wamr"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate ci jobs for each wasmer feature for ease of review.

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -24,4 +25,20 @@ jobs:
with:
name: holochain-ci
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: nix develop --command ${{ matrix.script }}
- run: nix develop --command ./${{ matrix.script }}-${{ matrix.wasmer-feature }}.sh

test-windows:
Copy link
Member Author

@mattyg mattyg Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Test for both wasmer features on windows
  • Move test-windows ci job into same file to make it more obvious that both jobs need to be modified together

runs-on: windows-latest
matrix:
wasmer-feature: ["wasmer_sys", "wasmer_wamr"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: test root
run: cargo test --release --no-default-features --features ${{ matrix.wasmer-feature }} -- --nocapture
- name: test
run: cargo test --release --manifest-path test/Cargo.toml --no-default-features --features ${{ matrix.wasmer-feature }} -- --nocapture
- name: bench
run: cd test && cargo bench --no-default-features --features ${{ matrix.wasmer-feature }}
19 changes: 0 additions & 19 deletions .github/workflows/windows.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ very reasonable overhead for the host to build a completely fresh instance.
Calling a function with `holochain_wasmer_host::guest::call()` takes several `us`
for small input/output values and some `ms` for ~1mb of input/output data.

To see benchmarks on your system run `nix-shell --run ./bench.sh`.
To see benchmarks on your system run `nix-shell --run ./scripts/bench.sh`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all scripts into scripts dir


With low overhead like this, core is relatively free to decide when it wants to
re-instantiate an already-in-memory module.
Expand Down
1 change: 1 addition & 0 deletions crates/host/src/module/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ impl SerializedModuleCache {
});
let (module, serialized_module) = match module_load {
Some(Ok(serialized_module)) => {
tracing::info!("get_with_build_cache serialized_module={:?}", serialized_module);
let deserialized_module =
unsafe { Module::deserialize(&self.runtime_engine, serialized_module.clone()) }
.map_err(|e| wasm_error!(WasmErrorInner::Compile(e.to_string())))?;
Expand Down
2 changes: 1 addition & 1 deletion bench.sh → scripts/bench-wasmer_sys.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env bash
(
cd test && \
cargo bench
cargo bench --no-default-features --features wasmer_sys
)

# it's possible to flamegraph the benchmarks like this:
Expand Down
10 changes: 10 additions & 0 deletions scripts/bench-wasmer_wamr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /usr/bin/env bash
(
cd test && \
cargo bench --no-default-features --features wasmer_wamr
)

# it's possible to flamegraph the benchmarks like this:
#
# cd test
# flamegraph cargo bench --bench bench -- --profile-time 10
4 changes: 4 additions & 0 deletions scripts/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env bash

./bench-wasmer_sys.sh && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to && rather than just sequential commands?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so that if the first command fails you see the failure output as the last text in the terminal rather than having it get buried by the output of the subsequent command. I don't have a strong preference either way.

./bench-wasmer_wamr.sh
2 changes: 1 addition & 1 deletion fuzz.sh → scripts/fuzz-wasmer_sys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
cargo test
cargo test --manifest-path test/Cargo.toml

cargo test-fuzz "$FUZZ_TARGET"
cargo test-fuzz "$FUZZ_TARGET" --no-default-features --features wasmer_sys
5 changes: 5 additions & 0 deletions scripts/fuzz-wasmer_wamr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env bash
cargo test
cargo test --manifest-path test/Cargo.toml

cargo test-fuzz "$FUZZ_TARGET" --no-default-features --features wasmer_wamr
4 changes: 4 additions & 0 deletions scripts/fuzz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env bash

./fuzz-wasmer_sys.sh && \
./fuzz-wasmer_wamr.sh
9 changes: 2 additions & 7 deletions test.sh → scripts/test-wasmer_sys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ cargo fmt
cargo clippy
( cd test && cargo clippy )
( cd crates/guest && cargo clippy --target wasm32-unknown-unknown )
cargo clippy --no-default-features --features wasmer_wamr
( cd test && cargo clippy --no-default-features --features wasmer_wamr )

# tests the root workspace that doesn't include any wasm code
cargo test ${1-} -- --nocapture
cargo test --no-default-features --features wasmer_sys ${1-} -- --nocapture

# test that everything builds
cargo build --release --manifest-path test/test_wasm/Cargo.toml --target wasm32-unknown-unknown

# build wasm and run the "full" tests for wasmer_sys
cargo test --release --manifest-path test/Cargo.toml ${1-} -- --nocapture

# build wasm and run the "full" tests for wasmer_wamr
cargo test --release --manifest-path test/Cargo.toml --no-default-features --features wasmer_wamr ${1-} -- --nocapture
cargo test --release --manifest-path test/Cargo.toml --no-default-features --features wasmer_sys ${1-} -- --nocapture
11 changes: 11 additions & 0 deletions scripts/test-wasmer_wamr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euxo pipefail

export RUST_BACKTRACE=full
export WASMER_BACKTRACE=1

cargo clippy --no-default-features --features wasmer_wamr
( cd test && cargo clippy --no-default-features --features wasmer_wamr )

# build wasm and run the "full" tests for wasmer_wamr
cargo test --release --manifest-path test/Cargo.toml --no-default-features --features wasmer_wamr ${1-} -- --nocapture
4 changes: 4 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env bash

./test-wasmer_sys.sh && \
./test-wasmer_wamr.sh
4 changes: 4 additions & 0 deletions test/benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Temporarily include a fork of wasmer from the git branch 'wamr', until it is officially released in wasmer v5
#[cfg(feature = "wasmer_wamr")]
extern crate hc_wasmer as wasmer;

use criterion::BenchmarkId;
use criterion::Throughput;
use criterion::{criterion_group, criterion_main, Criterion};
Expand Down
1 change: 1 addition & 0 deletions test/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod import;
pub mod wasms;

// Temporarily include a fork of wasmer from the git branch 'wamr', until it is officially released in wasmer v5
#[cfg(feature = "wasmer_wamr")]
extern crate hc_wasmer as wasmer;

Expand Down