Skip to content

Commit 5560b4a

Browse files
authored
💥 Reorganize Crates (temporalio#1034)
1 parent 35e021b commit 5560b4a

357 files changed

Lines changed: 1997 additions & 1891 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
integ-test = [
88
"test",
99
"--features",
10-
"temporal-sdk-core-protos/serde_serialize",
10+
"temporalio-common/serde_serialize",
1111
"--features",
1212
"test-utilities",
1313
"--features",
1414
"ephemeral-server",
1515
"--package",
16-
"temporal-sdk-core",
16+
"temporalio-sdk-core",
1717
"--test",
1818
"integ_runner",
1919
"--",
@@ -50,6 +50,12 @@ lint-fix = [
5050
"heavy_tests",
5151
"--test",
5252
"manual_tests",
53+
"--test",
54+
"cloud_tests",
55+
"--test",
56+
"integ_runner",
57+
"--test",
58+
"global_metric_tests",
5359
"--fix",
5460
"--allow-dirty",
5561
]

.github/workflows/per-pr.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
fail-fast: false
4545
matrix:
46-
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
46+
os: [ ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest ]
4747
include:
4848
- os: windows-latest
4949
- os: ubuntu-latest
@@ -80,7 +80,7 @@ jobs:
8080
id: find-cgroup-test
8181
if: runner.os == 'Linux' && runner.arch == 'X64'
8282
run: |
83-
test_executable=$(cargo build --tests --message-format json | jq -r 'select(.profile?.test == true and .target?.name == "temporal_sdk_core" and .executable) | .executable')
83+
test_executable=$(cargo build --tests --message-format json | jq -r 'select(.profile?.test == true and .target?.name == "temporalio_sdk_core" and .executable) | .executable')
8484
cp $test_executable ./core-tests
8585
- name: Upload cgroup test executable
8686
uses: actions/upload-artifact@v4
@@ -113,8 +113,8 @@ jobs:
113113
name: cgroup-tests-linux-x86_64
114114
- name: Run tests
115115
run: |
116-
chmod +x ./core-tests
117-
./core-tests cgroup_ --nocapture
116+
chmod +x ./core-tests
117+
./core-tests cgroup_ --nocapture
118118
119119
120120
integ-tests:
@@ -123,7 +123,7 @@ jobs:
123123
strategy:
124124
fail-fast: false
125125
matrix:
126-
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
126+
os: [ ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest ]
127127
include:
128128
- os: windows-latest
129129
- os: ubuntu-latest
@@ -206,7 +206,7 @@ jobs:
206206
- name: Start container for otel-collector and prometheus
207207
uses: hoverkraft-tech/compose-action@v2.0.1
208208
with:
209-
compose-file: ./docker/docker-compose-ci.yaml
209+
compose-file: ./etc/docker/docker-compose-ci.yaml
210210
- uses: Swatinem/rust-cache@v2
211211
- run: cargo integ-test docker_
212212

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

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

231231
- name: Build C test program
232-
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
232+
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
233233

234234
- name: Run C test program
235235
run: ./test

AGENTS.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@ document as your quick reference when submitting pull requests.
55

66
## Where Things Are
77

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

2121
## Repo Specific Utilities
2222

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

3230
## Building and Testing
3331

@@ -75,6 +73,6 @@ Reviewers will look for:
7573
## Notes
7674

7775
- Fetch workflow histories with `cargo run --bin histfetch <workflow_id> [run_id]` (binary lives in
78-
`test-utils`).
79-
- Protobuf files under `sdk-core-protos/protos/api_upstream` are a git subtree; see `README.md` for
80-
update instructions.
76+
`crates/core/src/histfetch.rs`).
77+
- Protobuf files under `crates/sdk-core-protos/protos/api_upstream` are a git subtree; see
78+
`README.md` for update instructions.

Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[workspace]
22
members = [
3-
"core",
4-
"client",
5-
"core-api",
6-
"fsm",
7-
"sdk-core-protos",
8-
"sdk",
9-
"core-c-bridge",
3+
"crates/sdk-core",
4+
"crates/client",
5+
"crates/common",
6+
"crates/macros",
7+
"crates/sdk",
8+
"crates/sdk-core-c-bridge",
109
]
1110
resolver = "2"
1211

README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,16 @@ installed to build Core.
2626

2727
This repo is composed of multiple crates:
2828

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

3836
Visualized (dev dependencies are in blue):
3937

40-
![Crate dependency graph](./etc/deps.svg)
38+
![Crate dependency graph](./arch_docs/diagrams/deps.svg)
4139

4240
All the following commands are enforced for each pull request:
4341

@@ -64,8 +62,8 @@ To format all code run:
6462
## Linting
6563

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

7068
## Debugging
7169

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

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

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

85-
`docker-compose -f docker/docker-compose.yaml -f docker/docker-compose-telem.yaml up`
83+
`docker-compose -f etc/docker/docker-compose.yaml -f etc/docker/docker-compose-telem.yaml up`
8684

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

arch_docs/diagrams/deps.svg

Lines changed: 102 additions & 0 deletions
Loading
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
2-
name = "temporal-client"
2+
name = "temporalio-client"
33
version = "0.1.0"
44
edition = "2024"
5-
authors = ["Spencer Judge <spencer@temporal.io>"]
5+
authors = ["Temporal Technologies Inc. <sdk@temporal.io>"]
66
license-file = { workspace = true }
7-
description = "Clients for interacting with Temporal Clusters"
7+
description = "Clients for interacting with Temporal"
88
homepage = "https://temporal.io/"
99
repository = "https://github.com/temporalio/sdk-core"
1010
keywords = ["temporal", "workflow"]
@@ -39,11 +39,8 @@ tracing = "0.1"
3939
url = "2.5"
4040
uuid = { version = "1.18", features = ["v4"] }
4141

42-
[dependencies.temporal-sdk-core-protos]
43-
path = "../sdk-core-protos"
44-
45-
[dependencies.temporal-sdk-core-api]
46-
path = "../core-api"
42+
[dependencies.temporalio-common]
43+
path = "../common"
4744

4845
[dev-dependencies]
4946
assert_matches = "1"

0 commit comments

Comments
 (0)