Skip to content

Commit

Permalink
Extract the runner module into its own crate (#678)
Browse files Browse the repository at this point in the history
* Extract the `runner` module into its own crate

This commit extracts the utiility runner module, used in the integration
tests into its own private crate.
The main motivation for this change is to enable sharing this
functionality between integration tests and the upcoming `javy-fuzz`
crate.

Additionally, this change promotes some dependencies to the
workspace level, namely:

- `tempfile`
- `uuid`

* Add tests

* Add a separate lint job for `javy-runner`

* Use `take` instead

* Remove redundant `static`

* Remove `capacity` from runner options
  • Loading branch information
saulecabrera authored Jul 2, 2024
1 parent 442c01c commit 5880e7b
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 106 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,21 @@ jobs:
- name: Test
env:
CARGO_TARGET_WASM32_WASI_RUNNER: wasmtime --dir=.
run: cargo hack wasi test --workspace --exclude=javy-cli --exclude=javy-config --each-feature -- --nocapture
run: cargo hack wasi test --workspace --exclude=javy-cli --exclude=javy-config --exclude=javy-runner --each-feature -- --nocapture

- name: Test Config
run: cargo test --package=javy-config

- name: Test Runner
run: cargo test --package=javy-runner

- name: Lint
run: cargo clippy --workspace --exclude=javy-cli --target=wasm32-wasi --all-targets -- -D warnings
run: cargo clippy --workspace --exclude=javy-cli --exclude=javy-runner --target=wasm32-wasi --all-targets -- -D warnings

# We need to specify a different job for linting `javy-runner` given that
# it depends on Wasmtime and Cranelift cannot be compiled to `wasm32-wasi`
- name: Lint Runner
run: cargo clippy --package=javy-runner -- -D warnings

- name: Upload core binary to artifacts
uses: actions/upload-artifact@v4
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"crates/cli",
"crates/test-macros",
"crates/config",
"crates/runner",
]
resolver = "2"

Expand All @@ -27,6 +28,8 @@ once_cell = "1.19"
bitflags = "2.5.0"
javy-config = { path = "crates/config" }
javy = { path = "crates/javy", version = "3.0.0" }
tempfile = "3.10.1"
uuid = { version = "1.8", features = ["v4"] }

[profile.release]
lto = true
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ test-core:
test-cli: core
CARGO_PROFILE_RELEASE_LTO=off cargo test --package=javy-cli --release --features=$(CLI_FEATURES) -- --nocapture

test-runner:
cargo test --package=javy-runner -- --nocapture

# WPT requires a Javy build with the experimental_event_loop feature to pass
test-wpt: export CORE_FEATURES ?= experimental_event_loop
test-wpt:
Expand All @@ -44,7 +47,7 @@ test-wpt:
test-config:
CARGO_PROFILE_RELEASE_LTO=off cargo test --package=javy-config -- --nocapture

tests: test-javy test-core test-cli test-wpt test-config
tests: test-javy test-core test-runner test-cli test-wpt test-config

fmt: fmt-quickjs-wasm-sys fmt-quickjs-wasm-rs fmt-javy fmt-apis fmt-core fmt-cli

Expand Down
5 changes: 3 additions & 2 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ swc_core = { version = "0.92.8", features = [
wit-parser = "0.209.1"
convert_case = "0.6.0"
wasm-opt = "0.116.1"
tempfile = "3.10.1"
tempfile = { workspace = true }
clap = { version = "4.5.7", features = ["derive"] }

[dev-dependencies]
serde_json = "1.0"
uuid = { version = "1.8", features = ["v4"] }
lazy_static = "1.4"
serde = { version = "1.0", default-features = false, features = ["derive"] }
criterion = "0.5"
num-format = "0.4.4"
wasmparser = "0.209.1"
javy-runner = { path = "../runner/" }
uuid = { workspace = true }

[build-dependencies]
anyhow = "1.0.86"
Expand Down
Loading

0 comments on commit 5880e7b

Please sign in to comment.