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

Benchmark action #185

Closed
wants to merge 2 commits into from
Closed
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
36 changes: 29 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,41 @@ jobs:
url: "https://github.com/deislabs/bindle/releases/download/v0.8.0/bindle-v0.8.0-linux-amd64.tar.gz"
pathInArchive: "bindle-server"

- name: Cargo Format
run:
cargo fmt --all -- --check

- uses: Swatinem/rust-cache@v1

- name: Cargo Build
run: cargo build
- name: Cargo Test
run:
RUST_LOG=spin=trace cargo test --all --all-features -- --nocapture
- name: Cargo Clippy
run:
cargo clippy --all-targets --all-features -- -D warnings
- name: Cargo Format

- name: Cargo Test
run:
cargo fmt --all -- --check
RUST_LOG=spin=trace cargo test --all --all-features -- --nocapture

- name: Cargo Build
run: cargo build --release

- name: Download previous benchmark results
# if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: benchmark-data
path: target/criterion
- name: Benchmarks
# if: ${{ github.ref == 'refs/heads/main' }}
run: |
cargo install cargo-criterion
cargo criterion --workspace
- name: Upload benchmark results
# if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3
with:
name: benchmark-data
path: target/criterion

# Cancel in-progress runs for PRs
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
Expand Down
136 changes: 136 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");

std::fs::create_dir_all("target/test-programs").unwrap();

build_wasm_test_program("rust-http-test.wasm", "crates/http/tests/rust-http-test");
build_wasm_test_program("redis-rust.wasm", "crates/redis/tests/rust");
build_wasm_test_program("wagi-test.wasm", "crates/http/tests/wagi-test");

build_wasm_test_program(
"spin-http-benchmark.wasm",
"crates/http/benches/spin-http-benchmark",
);
build_wasm_test_program("wagi-benchmark.wasm", "crates/http/benches/wagi-benchmark");

cargo_build(RUST_HTTP_INTEGRATION_TEST);
cargo_build(RUST_HTTP_INTEGRATION_ENV_TEST);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl ApplicationTrigger {
}

/// WebAssembly configuration.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct WasmConfig {
/// Environment variables to be mapped inside the Wasm module at runtime.
pub environment: HashMap<String, String>,
Expand Down
6 changes: 6 additions & 0 deletions crates/http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ wasmtime-wasi = "0.34"
wit-bindgen-wasmtime = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "e9c7c0a3405845cecd3fe06f3c20ab413302fc73" }

[dev-dependencies]
criterion = { version = "0.3.5", features = ["async_tokio"] }
miniserde = "0.1"
num_cpus = "1"

[[bench]]
name = "baseline"
harness = false
Loading