Skip to content

Commit 2226ddd

Browse files
authored
devex: add justfiles for bridge and CLI; add cargo-sort to CI (#2425)
This adds justfiles for `bridge` and `svix-cli` (which are basically the same as the justfile for `server`). It also adds `cargo-sort` to CI for bridge and svix-cli.
1 parent 49b9380 commit 2226ddd

11 files changed

Lines changed: 136 additions & 85 deletions

File tree

.github/workflows/bridge-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ jobs:
2525
- name: rustfmt
2626
run: cargo fmt -- --check
2727

28+
cargo-sort:
29+
name: 'Run cargo-sort'
30+
runs-on: ubuntu-24.04
31+
steps:
32+
- uses: actions/checkout@v7
33+
name: Checkout
34+
35+
- name: Install cargo sort
36+
uses: taiki-e/install-action@7a79fe8c3a13344501c80d99cae481c1c9085912 # v2.81.10
37+
with:
38+
tool: cargo-sort
39+
40+
- name: Run cargo sort
41+
run: cargo sort --workspace --check --check-format
42+
2843
check-unused-deps:
2944
name: Check for unused dependencies
3045
runs-on: ubuntu-24.04

.github/workflows/cli-lint.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ jobs:
2424
- name: rustfmt
2525
run: cargo fmt -- --check
2626

27+
cargo-sort:
28+
name: 'Run cargo-sort'
29+
runs-on: ubuntu-24.04
30+
steps:
31+
- uses: actions/checkout@v7
32+
name: Checkout
33+
34+
- name: Install cargo sort
35+
uses: taiki-e/install-action@7a79fe8c3a13344501c80d99cae481c1c9085912 # v2.81.10
36+
with:
37+
tool: cargo-sort
38+
39+
- name: Run cargo sort
40+
run: cargo sort --workspace --check --check-format
41+
2742
test-versions:
2843
name: CLI Lint
2944
runs-on: ubuntu-24.04

.justfile-common-rust

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Reformat both this justfile and the rust sources.
2+
[no-exit-message]
3+
fmt:
4+
cargo +nightly fmt --all
5+
cargo sort --workspace
6+
cargo machete --fix
7+
just --fmt --unstable
8+
9+
# Run `cargo clippy` for the rfust codebase.
10+
clippy *args='':
11+
cargo clippy --all-targets {{ args }} -- -D warnings
12+
13+
# Run lints (fmt and clippy)
14+
lint: fmt clippy && fmt
15+
16+
# Run `cargo check` on the rust codebase
17+
check:
18+
cargo check --all-targets
19+
20+
# vim: set syntax=just:

bridge/.justfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set dotenv-load
2+
set default-list
3+
4+
import "../.justfile-common-rust"
5+
6+
HERE := justfile_directory()
7+
8+
# Run the bridge server
9+
run *args='':
10+
cargo run -- {{ args }}
11+
12+
# Invokes `docker compose` with the testing configuration in the 'bridge' directory
13+
[no-exit-message]
14+
dc *args='':
15+
docker compose -p svix-oss -f {{ HERE / "testing-docker-compose.yml" }} {{ args }}

bridge/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ resolver = "2"
77

88
members = [
99
"svix-bridge",
10-
"svix-bridge-types",
11-
"svix-bridge-plugin-queue",
1210
"svix-bridge-plugin-kafka",
11+
"svix-bridge-plugin-queue",
12+
"svix-bridge-types",
1313
]
1414

1515
[workspace.package]
@@ -32,8 +32,8 @@ uninlined_format_args = "warn"
3232

3333
[workspace.dependencies]
3434
opentelemetry = "0.32.0"
35-
opentelemetry_sdk = { version = "0.32.0", features = ["metrics", "rt-tokio", "experimental_metrics_periodicreader_with_async_runtime", "experimental_trace_batch_span_processor_with_async_runtime"] }
3635
opentelemetry-otlp = { version = "0.32.0", features = ["metrics", "grpc-tonic", "reqwest-client"] }
36+
opentelemetry_sdk = { version = "0.32.0", features = ["metrics", "rt-tokio", "experimental_metrics_periodicreader_with_async_runtime", "experimental_trace_batch_span_processor_with_async_runtime"] }
3737
serde = { version = "1.0.203", features = ["derive"] }
3838
serde_json = "1.0.117"
3939
svix-bridge-types = { path = "svix-bridge-types" }

bridge/svix-bridge-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ license.workspace = true
88

99
[dependencies]
1010
async-trait = "0.1"
11-
tokio.workspace = true
1211
serde.workspace = true
1312
serde_json.workspace = true
1413
svix = { path = "../../rust", features = ["svix_beta"] }
14+
tokio.workspace = true
1515

1616
[lints]
1717
workspace = true

bridge/svix-bridge/Cargo.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,47 @@ rust-version = "1.91"
66
publish = false
77
license.workspace = true
88

9+
[features]
10+
default = ["kafka", "jemalloc"]
11+
kafka = ["dep:svix-bridge-plugin-kafka"]
12+
jemalloc = ["tikv-jemallocator", "tikv-jemalloc-ctl"]
13+
14+
[target.'cfg(not(target_env = "msvc"))'.dependencies]
15+
tikv-jemalloc-ctl = { version = "0.6.0", optional = true, features = ["use_std", "stats"] }
16+
tikv-jemallocator = { version = "0.6.0", optional = true }
17+
918
[dependencies]
1019
anyhow = "1"
11-
clap = { version = "4.2.4", features = ["env", "derive"] }
1220
axum = { version = "0.7.7", features = ["macros"] }
21+
clap = { version = "4.2.4", features = ["env", "derive"] }
22+
deadpool = { version = "0.12.1", features = ["unmanaged", "rt_tokio_1"] }
23+
deno_ast = "0.53.0"
24+
deno_core = "0.352.1"
1325
enum_dispatch = "0.3"
1426
indexmap = { version = "2.10.0", features = ["serde"] }
1527
itertools = "0.14.0"
1628
once_cell = "1.18.0"
1729
opentelemetry.workspace = true
18-
opentelemetry_sdk.workspace = true
1930
opentelemetry-otlp.workspace = true
31+
opentelemetry_sdk.workspace = true
32+
reqwest = { version = "0.13.4", features = ["json"] }
2033
serde.workspace = true
2134
serde_json.workspace = true
2235
serde_yaml = "0.9"
23-
svix-ksuid = "0.8.0"
24-
svix-bridge-plugin-queue = { path = "../svix-bridge-plugin-queue" }
36+
shellexpand = { version = "3.1.0", default-features = false, features = ["base-0"] }
2537
svix-bridge-plugin-kafka = { optional = true, path = "../svix-bridge-plugin-kafka" }
38+
svix-bridge-plugin-queue = { path = "../svix-bridge-plugin-queue" }
2639
svix-bridge-types.workspace = true
40+
svix-ksuid = "0.8.0"
2741
tokio.workspace = true
2842
tracing.workspace = true
2943
tracing-opentelemetry = "0.33.0"
3044
tracing-subscriber = { workspace = true, features = ["fmt", "json"] }
31-
deno_core = "0.352.1"
32-
deno_ast = "0.53.0"
33-
deadpool = { version = "0.12.1", features = ["unmanaged", "rt_tokio_1"] }
34-
shellexpand = { version = "3.1.0", default-features = false, features = ["base-0"] }
3545
url = "2.5.4"
36-
reqwest = { version = "0.13.4", features = ["json"] }
37-
38-
[target.'cfg(not(target_env = "msvc"))'.dependencies]
39-
tikv-jemallocator = { version = "0.6.0", optional = true }
40-
tikv-jemalloc-ctl = { version = "0.6.0", optional = true, features = ["use_std", "stats"] }
4146

4247
[dev-dependencies]
4348
chrono = "0.4"
4449
tower = "0.5.1"
4550

46-
[features]
47-
default = ["kafka", "jemalloc"]
48-
kafka = ["dep:svix-bridge-plugin-kafka"]
49-
jemalloc = ["tikv-jemallocator", "tikv-jemalloc-ctl"]
50-
5151
[lints]
5252
workspace = true

justfile

Lines changed: 0 additions & 58 deletions
This file was deleted.

server/.justfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set dotenv-load
2+
set default-list
3+
4+
import "../.justfile-common-rust"
5+
6+
PYTHON := "python3.14"
7+
HERE := justfile_directory()
8+
ENVFILE := HERE / "svix-server" / "development.env"
9+
10+
# Run the svix server
11+
run *args='':
12+
cargo run -p svix-server -- {{ args }}
13+
14+
# Generates a new `openapi.json`. Pass `--check` to compare the spec that would be generated to the current version of the file. Make sure to update `codegen/lib-openapi.json` first.
15+
[no-exit-message]
16+
generate-openapi:
17+
bash generate-openapi.sh
18+
19+
# Regenerate all client libraries
20+
[no-exit-message]
21+
[working-directory(HERE / "..")]
22+
codegen:
23+
{{ PYTHON }} regen_openapi.py
24+
25+
# Invokes `docker compose` with the testing configuration in the server directory
26+
[no-exit-message]
27+
dc *args='':
28+
docker compose -p svix-oss -f {{ HERE / "testing-docker-compose.yml" }} {{ args }}

svix-cli/.justfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set dotenv-load
2+
set default-list
3+
4+
import "../.justfile-common-rust"
5+
6+
HERE := justfile_directory()
7+
8+
# Run the CLI
9+
run *args='':
10+
cargo run -- {{ args }}

0 commit comments

Comments
 (0)