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

Final durability related refactorings #1278

Merged
merged 8 commits into from
Jan 30, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ jobs:
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare WIT dependencies
run: cargo make wit
- name: Build wasm-rpc in stub mode
run: cargo component build -p golem-wasm-rpc --no-default-features --features stub

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ golem-client/*
logs
data
.DS_Store
wit/deps
wasm-rpc/wit/deps
durable-wasi/wit/deps
4 changes: 2 additions & 2 deletions Cargo.lock

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

42 changes: 39 additions & 3 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# List of top-level tasks intended for use:
#
# - `cargo make dev-flow` or just `cargo make`: runs a full development flow, including fixing format and clippy, building and running tests and generating OpenAPI specs
# - `cargo make wit`: fetches the WIT dependencies based on wit/deps.toml
# - `cargo make build`: builds everything in debug mode
# - `cargo make build-release`: builds everything in release mode. customizable with PLATFORM_OVERRIDE env variable for docker builds
# - `cargo make check`: runs rustfmt and clippy checks without applying any fix
Expand Down Expand Up @@ -46,13 +47,35 @@ alias = "dev-flow"
[tasks.dev-flow]
description = "Runs a full development flow, including fixing format and clippy, building and running tests"
dependencies = [
"wit",
"fix",
"check",
"build",
# "test"
]

# WIT DEPENDENCIES
[tasks.wit]
description = "Fetches the WIT dependencies based on wit/deps.toml"
dependencies = ["wit-host", "wit-wasm-rpc"]

[tasks.wit-wasm-rpc]
dependencies = ["wit-host"]
script_runner = "@duckscript"
script = """
rm -r wasm-rpc/wit/deps
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really want to delete and re-get the deps on basically every command? (i know that wit-deps uses a cache, and probably not a huge performance problem, still feels wasteful)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not "regetting" them just copying them from the project root's wit/deps. We can try to make a better script for it but

  • it needs to be working on all platforms - that's why i used this 🦆 thing
  • it needs to remove things that are no longer there - i already ran into that multiple times as i was trying to figure out the proper name for the new wit package

Copy link
Contributor

Choose a reason for hiding this comment

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

by "regetting" i meant wit-host also runs on everything now, and yes, i understand that it would need a "task checker", will think about it (ironically golem-cli app could do it :D)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The wit-dep update is designed to be runnable every time. That's why it keeps a lock file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Based on bytecodealliance/wit-deps#202 being closed)

mkdir wasm-rpc/wit/deps
cp wit/deps/io wasm-rpc/wit/deps
cp wit/deps/wasm-rpc wasm-rpc/wit/deps
"""

[tasks.wit-host]
install_crate = { crate_name = "wit-deps-cli", binary = "wit-deps", test_arg = "--help" }
command = "wit-deps"
args = ["update"]

[tasks.build]
dependencies = ["wit"]
description = "Builds everything in debug mode"
command = "cargo"
args = ["build", "--workspace", "--all-targets"]
Expand All @@ -64,16 +87,19 @@ condition = { env_not_set = [
run_task = "build-bins"

[tasks.build-bins]
dependencies = ["wit"]
description = "Builds all executables in debug mode"
command = "cargo"
args = ["build", "--workspace", "--bins"]

[tasks.build-worker-service]
dependencies = ["wit"]
description = "Builds the worker-service"
command = "cargo"
args = ["build", "-p", "golem-worker-service"]

[tasks.build-component-service]
dependencies = ["wit"]
description = "Builds the component-service"
command = "cargo"
args = ["build", "-p", "golem-component-service"]
Expand All @@ -83,6 +109,7 @@ description = """This is the top-level task that builds everything in release mo
to build for other target than the current one, can be linux/amd64 or linux/arm64. This is used for cross-compiling
for docker images."""
dependencies = [
"wit",
"set-version",
"build-release-default",
"build-release-override-linux-amd64",
Expand Down Expand Up @@ -115,7 +142,7 @@ args = ["build", "--release", "--target", "aarch64-unknown-linux-gnu"]

[tasks.check]
description = "Runs rustfmt and clippy checks without applying any fix"
dependencies = ["check-clippy", "check-rustfmt"]
dependencies = ["wit", "check-clippy", "check-rustfmt"]

[tasks.check-rustfmt]
description = "Runs rustfmt checks without applying any fix"
Expand All @@ -133,7 +160,7 @@ args = ["clippy", "--all-targets", "--", "--no-deps", "-Dwarnings"]

[tasks.fix]
description = "Runs rustfmt and clippy checks and applies fixes"
dependencies = ["fix-clippy", "fix-rustfmt"]
dependencies = ["wit", "fix-clippy", "fix-rustfmt"]

[tasks.fix-rustfmt]
description = "Runs rustfmt checks and applies fixes"
Expand All @@ -154,7 +181,6 @@ args = [
"--no-deps",
"-Dwarnings",
]

## ** TEST **

[tasks.test]
Expand All @@ -168,13 +194,15 @@ dependencies = [
]

[tasks.unit-tests]
dependencies = ["wit"]
description = "Runs unit tests only"
script = '''
cargo test --workspace --lib --all-features --exclude wasm-rpc-stubgen-tests-integration -- --nocapture --report-time $JUNIT_OPTS
cargo test -p golem-wasm-ast --tests --all-features -- --nocapture --report-time $JUNIT_OPTS
'''

[tasks.worker-executor-tests]
dependencies = ["wit"]
description = "Runs worker executor tests only"
env = { "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_BACKTRACE" = "1", "RUST_LOG" = "info" }
command = "cargo"
Expand All @@ -189,6 +217,7 @@ args = [
]

[tasks.worker-executor-tests-group1]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 1/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
Expand All @@ -197,48 +226,55 @@ cargo test --package golem-worker-executor-base --test integration :tag:group1 -
'''

[tasks.worker-executor-tests-group2]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 2/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group2 -- --report-time
'''

[tasks.worker-executor-tests-group3]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 3/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group3 -- --report-time
'''

[tasks.worker-executor-tests-group4]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 4/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group4 -- --report-time $JUNIT_OPTS
'''

[tasks.worker-executor-tests-group5]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 5/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group5 -- --report-time
'''

[tasks.worker-executor-tests-group6]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 6/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group6 -- --report-time
'''

[tasks.worker-executor-tests-group7]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 7/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
cargo test --package golem-worker-executor-base --test integration :tag:group7 -- --report-time
'''

[tasks.worker-executor-tests-group8]
dependencies = ["wit"]
description = "Runs worker executor tests only (group 8/8)"
env = { "RUST_BACKTRACE" = "1", "WASMTIME_BACKTRACE_DETAILS" = "1", "RUST_LOG" = "info", "RUST_TEST_TIME_INTEGRATION" = "5000,30000" }
script = '''
Expand Down
2 changes: 1 addition & 1 deletion golem-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include = ["src/**/*", "Cargo.toml", "build.rs", "openapi/**/*"]
harness = false

[dependencies]
golem-common = { path = "../golem-common", version = "=0.0.0", default-features = false }
golem-common = { path = "../golem-common", version = "=0.0.0", default-features = false, features = ["model"] }
golem-wasm-ast = { path = "../wasm-ast", version = "=0.0.0", default-features = false, features = ["analysis"] }
golem-wasm-rpc = { path = "../wasm-rpc", version = "=0.0.0", default-features = false }

Expand Down
11 changes: 7 additions & 4 deletions golem-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ repository = "https://github.com/golemcloud/golem"
description = "Shared code between Golem services"

[features]
default = ["config", "observability", "poem", "protobuf", "redis", "sql", "tokio"]
default = ["base-model", "config", "model", "observability", "poem", "protobuf", "redis", "serialization", "sql", "tokio"]

base-model = []
config = ["dep:figment"]
model = ["base-model", "dep:golem-wasm-rpc", "dep:golem-wasm-ast", "dep:golem-rib"]
observability = ["dep:console-subscriber", "dep:prometheus", "dep:tracing", "dep:tracing-subscriber", "dep:tracing-serde"]
poem = ["dep:poem", "dep:poem-openapi", "golem-wasm-ast/poem_openapi", "golem-wasm-ast/poem_openapi", "golem-rib/poem"]
protobuf = ["dep:prost", "dep:prost-types", "dep:tonic", "dep:golem-api-grpc", "golem-rib/protobuf", "golem-wasm-ast/protobuf", "golem-wasm-rpc/protobuf"]
redis = ["dep:fred"]
serialization = []
sql = ["dep:sqlx"]
tokio = ["dep:tokio"]

Expand All @@ -23,9 +26,9 @@ harness = false

[dependencies]
golem-api-grpc = { path = "../golem-api-grpc", version = "=0.0.0", optional = true }
golem-rib = { path = "../golem-rib", version = "=0.0.0", default-features = false, features = ["protobuf", "poem", "json_in_errors"] } # TODO: make these optionals
golem-wasm-ast = { path = "../wasm-ast", version = "=0.0.0", default-features = false, features = ["metadata"] }
golem-wasm-rpc = { path = "../wasm-rpc", version = "=0.0.0", default-features = false, features = ["host"] }
golem-rib = { path = "../golem-rib", version = "=0.0.0", default-features = false, features = ["protobuf", "poem", "json_in_errors"], optional = true } # TODO: make these optionals
golem-wasm-ast = { path = "../wasm-ast", version = "=0.0.0", default-features = false, features = ["metadata"], optional = true }
golem-wasm-rpc = { path = "../wasm-rpc", version = "=0.0.0", default-features = false, features = ["host"], optional = true }

anyhow = { workspace = true }
async-trait = { workspace = true }
Expand Down
Loading