Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 8 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
integ-test = [
"test",
"--features",
"temporal-sdk-core-protos/serde_serialize",
"temporalio-common/serde_serialize",
"--features",
"test-utilities",
"--features",
"ephemeral-server",
"--package",
"temporal-sdk-core",
"temporalio-sdk-core",
"--test",
"integ_runner",
"--",
Expand Down Expand Up @@ -50,6 +50,12 @@ lint-fix = [
"heavy_tests",
"--test",
"manual_tests",
"--test",
"cloud_tests",
"--test",
"integ_runner",
"--test",
"global_metric_tests",
"--fix",
"--allow-dirty",
]
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/per-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
os: [ ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest ]
include:
- os: windows-latest
- os: ubuntu-latest
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
id: find-cgroup-test
if: runner.os == 'Linux' && runner.arch == 'X64'
run: |
test_executable=$(cargo build --tests --message-format json | jq -r 'select(.profile?.test == true and .target?.name == "temporal_sdk_core" and .executable) | .executable')
test_executable=$(cargo build --tests --message-format json | jq -r 'select(.profile?.test == true and .target?.name == "temporalio_sdk_core" and .executable) | .executable')
cp $test_executable ./core-tests
- name: Upload cgroup test executable
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -113,8 +113,8 @@ jobs:
name: cgroup-tests-linux-x86_64
- name: Run tests
run: |
chmod +x ./core-tests
./core-tests cgroup_ --nocapture
chmod +x ./core-tests
./core-tests cgroup_ --nocapture


integ-tests:
Expand All @@ -123,7 +123,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
os: [ ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest ]
include:
- os: windows-latest
- os: ubuntu-latest
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
- name: Start container for otel-collector and prometheus
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ./docker/docker-compose-ci.yaml
compose-file: ./etc/docker/docker-compose-ci.yaml
- uses: Swatinem/rust-cache@v2
- run: cargo integ-test docker_

Expand All @@ -226,10 +226,10 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build crate as static library
run: cargo rustc --package temporal-sdk-core-c-bridge --features xz2-static -- --crate-type=staticlib
run: cargo rustc --package temporalio-sdk-core-c-bridge --features xz2-static -- --crate-type=staticlib

- name: Build C test program
run: gcc -I./core-c-bridge/include tests/c_bridge_smoke_test.c target/debug/deps/libtemporal_sdk_core_c_bridge.a -lpthread -ldl -lm -o test
run: gcc -I./crates/sdk-core-c-bridge/include crates/sdk-core/tests/c_bridge_smoke_test.c target/debug/deps/libtemporalio_sdk_core_c_bridge.a -lpthread -ldl -lm -o test

- name: Run C test program
run: ./test
36 changes: 17 additions & 19 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,27 @@ document as your quick reference when submitting pull requests.

## Where Things Are

- `core/` – implementation of the core SDK
- `client/` – clients for communicating with Temporal clusters
- `core-api/` – API definitions exposed by core
- `core-c-bridge/` – C interface for core
- `sdk/` – pre-alpha Rust SDK built on top of core (used mainly for tests)
- `sdk-core-protos/` – protobuf definitions shared across crates
- `fsm/` – state machine implementation and macros
- `test-utils/` – helpers and binaries for tests
- `tests/` – integration, heavy, and manual tests
- `crates` - All crates in the workspace.
- `crates/core/` – implementation of the core SDK
- `crates/client/` – clients for communicating with Temporal clusters
- `crates/core-api/` – API definitions exposed by core
- `crates/core-c-bridge/` – C interface for core
- `crates/sdk/` – pre-alpha Rust SDK built on top of core (used mainly for tests)
- `crates/sdk-core-protos/` – protobuf definitions shared across crates
- `crates/fsm/` – state machine implementation and macros
- `crates/core/tests/` – integration, heavy, and manual tests
- `arch_docs/` – architectural design documents
- Contributor guide: `README.md`
- `target/` - This contains compiled files. You never need to look in here.

## Repo Specific Utilities

- `.cargo/config.toml` defines useful cargo aliases:
- `cargo lint` – run clippy on workspace crates
- `cargo test-lint` – run clippy on tests
- `cargo integ-test` – run the integration test runner
- `cargo-tokio-console.sh` – run any cargo command with the `tokio-console` feature
- `integ-with-otel.sh` – run integration tests with OpenTelemetry enabled
- `.cargo/multi-worker-manual-test` – helper script for spawning multiple workers during manual
testing
- `cargo lint` – run clippy on workspace crates
- `cargo test-lint` – run clippy on tests
- `cargo integ-test` – run the integration test runner
- `etc` - Various helper scripts and configuration
- `etc/docker` - Docker compose files to help with CI or more complex local testing

## Building and Testing

Expand Down Expand Up @@ -75,6 +73,6 @@ Reviewers will look for:
## Notes

- Fetch workflow histories with `cargo run --bin histfetch <workflow_id> [run_id]` (binary lives in
`test-utils`).
- Protobuf files under `sdk-core-protos/protos/api_upstream` are a git subtree; see `README.md` for
update instructions.
`crates/core/src/histfetch.rs`).
- Protobuf files under `crates/sdk-core-protos/protos/api_upstream` are a git subtree; see
`README.md` for update instructions.
13 changes: 6 additions & 7 deletions Cargo.toml
Copy link
Member

Choose a reason for hiding this comment

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

What about top-level folders for tests and sdk-core-protos, should they similarly be reorg'd? I figure non-crate stuff like etc and docker and such we can discuss separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

They are. Tests is moved inside the core crate. Protos is inside common. Docker is moved inside etc with all other misc. stuff

Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[workspace]
members = [
"core",
"client",
"core-api",
"fsm",
"sdk-core-protos",
"sdk",
"core-c-bridge",
"crates/sdk-core",
"crates/client",
"crates/common",
"crates/macros",
"crates/sdk",
"crates/sdk-core-c-bridge",
]
resolver = "2"

Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ installed to build Core.

This repo is composed of multiple crates:

- temporal-sdk-core-protos `./sdk-core-protos` - Holds the generated proto code and extensions.
- temporal-client `./client` - Defines client(s) for interacting with the Temporal gRPC service.
- temporal-sdk-core-api `./core-api` - Defines the API surface exposed by Core.
- temporal-sdk-core `./core` - The Core implementation.
- temporal-sdk-core-c-bridge `./core-c-bridge` - Provides C bindings for Core.
- temporal-sdk `./sdk` - A (currently prototype) Rust SDK built on top of Core. Used for testing.
- rustfsm `./fsm` - Implements a procedural macro used by core for defining state machines
(contains subcrates). It is Temporal-agnostic.
- temporalio-client `./crates/client` - Defines client(s) for interacting with the Temporal gRPC service.
- temporalio-common `./crates/common` - Common code & protobuf definitions
- temporalio-sdk-core `./crates/core` - The Core implementation.
- temporalio-sdk-core-c-bridge `./crates/core-c-bridge` - Provides C bindings for Core.
- temporalio-macros `./crates/macros` - Implements procedural macros used by core and the SDK.
- temporalio-sdk `./crates/sdk` - A (currently prototype) Rust SDK built on top of Core. Used for testing.

Visualized (dev dependencies are in blue):

![Crate dependency graph](./etc/deps.svg)
![Crate dependency graph](./arch_docs/diagrams/deps.svg)

All the following commands are enforced for each pull request:

Expand All @@ -64,8 +62,8 @@ To format all code run:
## Linting

We are using [clippy](https://github.com/rust-lang/rust-clippy) for linting.
You can run it using:
`cargo clippy --all -- -D warnings`
We have a couple aliases for linting that make sure various targets are hit:
`cargo lint` and `cargo test-lint`.

## Debugging

Expand All @@ -79,10 +77,10 @@ crate::telemetry::telemetry_init_fallback();

The passed in options to initialization can be customized to export to an OTel collector, etc.

To run integ tests with OTel collection on, you can use `integ-with-otel.sh`. You will want to make
sure you are running the collector via docker, which can be done like so:
To run integ tests with OTel collection on, you can use `etc/integ-with-otel.sh`. You will want to
make sure you are running the collector via docker, which can be done like so:

`docker-compose -f docker/docker-compose.yaml -f docker/docker-compose-telem.yaml up`
`docker-compose -f etc/docker/docker-compose.yaml -f etc/docker/docker-compose-telem.yaml up`

If you are working on a language SDK, you are expected to initialize tracing early in your `main`
equivalent.
Expand Down Expand Up @@ -137,4 +135,3 @@ pre-alpha in terms of its API surface. Since it's still using Core underneath, i
functional. We do not currently have any firm plans to productionize this SDK. If you want to write
workflows and activities in Rust, feel free to use it - but be aware that the API may change at any
time without warning and we do not provide any support guarantees.

102 changes: 102 additions & 0 deletions arch_docs/diagrams/deps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 5 additions & 8 deletions client/Cargo.toml → crates/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "temporal-client"
name = "temporalio-client"
version = "0.1.0"
edition = "2024"
authors = ["Spencer Judge <spencer@temporal.io>"]
authors = ["Temporal Technologies Inc. <sdk@temporal.io>"]
license-file = { workspace = true }
description = "Clients for interacting with Temporal Clusters"
description = "Clients for interacting with Temporal"
homepage = "https://temporal.io/"
repository = "https://github.com/temporalio/sdk-core"
keywords = ["temporal", "workflow"]
Expand Down Expand Up @@ -39,11 +39,8 @@ tracing = "0.1"
url = "2.5"
uuid = { version = "1.18", features = ["v4"] }

[dependencies.temporal-sdk-core-protos]
path = "../sdk-core-protos"

[dependencies.temporal-sdk-core-api]
path = "../core-api"
[dependencies.temporalio-common]
path = "../common"

[dev-dependencies]
assert_matches = "1"
Expand Down
File renamed without changes.
Loading
Loading