Skip to content

Commit

Permalink
Add HTTP gRPC crate (#949)
Browse files Browse the repository at this point in the history
* Rename to xmtp_api_http
* Update deps
* Fix settings
* Add streaming fns to HTTP client
* Allow using `http-api` feature flag to switch client
* add github CI workflow for http
* remove `tokio::spawn` in stream_all_messages by using async_stream
* make all Mutex's parking_lot
* update dependencies in xmtp_api_grpc
* remove unused dependencies in xmtp_api_grpc
---------

Co-authored-by: Ry Racherbaumer <[email protected]>
  • Loading branch information
insipx and rygine authored Aug 13, 2024
1 parent 5acd067 commit 44924a2
Show file tree
Hide file tree
Showing 42 changed files with 1,832 additions and 1,300 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/lint-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: Lint Workspace

on:
push:
branches:
- main

pull_request:
paths:
- ".github/workflows/lint.yaml"
- "mls_validation_service/**"
- "xmtp_api_grpc/**"
- "xmtp_api_http/**"
- "xmtp_cryptography/**"
- "xmtp_id/**"
- "xmtp_mls/**"
Expand All @@ -19,26 +18,21 @@ on:
- "Cargo.lock"
- "rust-toolchain"
- "rustfmt.toml"

jobs:
lint:
name: Lint
runs-on: warp-ubuntu-latest-x64-16x
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Update rust toolchains
run: rustup update

- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Run clippy and fail on warnings
run: cargo clippy --all-features --all-targets --no-deps -- -Dwarnings

- name: Run format check
run: cargo fmt --check
40 changes: 40 additions & 0 deletions .github/workflows/test-http-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test workspace with HTTP
on:
push:
branches:
- main
pull_request:
# only run tests when related changes are made
paths:
- ".github/workflows/test-workspace.yml"
- "dev/**"
- "mls_validation_service/**"
- "xmtp_api_http/**"
- "xmtp_cryptography/**"
- "xmtp_id/**"
- "xmtp_mls/**"
- "xmtp_proto/**"
- "xmtp_v2/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain"
jobs:
test:
name: Test
runs-on: warp-ubuntu-latest-x64-16x
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update rust toolchains
run: rustup update
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Start Docker containers
run: dev/up
- name: Run cargo test on main workspace
run: cargo test --workspace --exclude xmtp_api_grpc --features http-api -- --test-threads=2
8 changes: 0 additions & 8 deletions .github/workflows/test-workspace.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Test Workspace

on:
push:
branches:
- main

pull_request:
# only run tests when related changes are made
paths:
Expand All @@ -20,29 +18,23 @@ on:
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain"

jobs:
test:
name: Test
runs-on: warp-ubuntu-latest-x64-16x
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Update rust toolchains
run: rustup update

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Start Docker containers
run: dev/up

- name: Run cargo test on main workspace
run: cargo test -- --test-threads=2
37 changes: 16 additions & 21 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{
"rust-analyzer": {
"cargo": {
"sysroot": "discover"
},
"linkedProjects": [
"bindings_ffi/Cargo.toml",
"bindings_node/Cargo.toml",
"examples/cli/Cargo.toml",
"xmtp_api_grpc_gateway/Cargo.toml"
],
"procMacro": {
"enable": true,
"attributes.enable": true,
"ignored": {
"async-trait": ["async_trait"],
"napi-derive": ["napi"],
"async-recursion": ["async_recursion"],
"ctor": ["ctor"],
"tokio": ["test"]
}
}
"rust-analyzer.cargo.sysroot": "discover",
"rust-analyzer.linkedProjects": [
"bindings_ffi/Cargo.toml",
"bindings_node/Cargo.toml",
"bindings_wasm/Cargo.toml",
"examples/cli/Cargo.toml"
],
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.procMacro.attributes.enable": true,
"rust-analyzer.procMacro.ignored": {
"async-trait": ["async_trait"],
"napi-derive": ["napi"],
"async-recursion": ["async_recursion"],
"ctor": ["ctor"],
"tokio": ["test"],
"async-stream": ["stream", "try_stream"]
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
Expand Down
Loading

0 comments on commit 44924a2

Please sign in to comment.