Skip to content

Commit

Permalink
Merge pull request #18 from github/tclem/prune-features
Browse files Browse the repository at this point in the history
Prune dependencies and the features twirp-rs depends on, cargo update, fix ci
  • Loading branch information
tclem authored Mar 20, 2024
2 parents 163edf9 + a206aed commit ec98b3a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 44 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,6 +18,6 @@ jobs:
- name: Install protoc
run: script/install-protoc
- name: Build
run: cargo build
run: make build
- name: Run tests
run: cargo test
run: make test
35 changes: 0 additions & 35 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions crates/twirp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/github/twirp-rs"
default = ["client", "server", "test-support"]
test-support = ["dep:async-trait", "dep:tokio"]
client = ["dep:reqwest", "dep:url"]
server = ["dep:hyper"]
server = ["dep:axum", "dep:hyper", "dep:tower"]

[dependencies]
futures = "0.3"
Expand All @@ -23,16 +23,16 @@ serde_json = "1.0"
thiserror = "1.0"

# For the client feature
reqwest = { version = "0.11", features = ["default", "gzip", "json"], optional = true }
reqwest = { version = "0.11", default-features = false, optional = true }
url = { version = "2.5", optional = true }

# For the server feature
axum = "0.7"
axum = { version = "0.7", default-features = false, optional = true }
bytes = "1.5"
http = "1.0"
http-body-util = "0.1"
hyper = { version = "1.1", features = ["full"], optional = true }
tower = "0.4"
hyper = { version = "1.1", default-features = false, optional = true }
tower = { version = "0.4", default-features = false, optional = true }

# For the test-support feature
async-trait = { version = "0.1", optional = true }
Expand Down
4 changes: 3 additions & 1 deletion crates/twirp/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use crate::{error, Client, Result, TwirpErrorResponse};
pub async fn run_test_server(port: u16) -> JoinHandle<Result<(), std::io::Error>> {
let router = test_api_router();
let addr: std::net::SocketAddr = ([127, 0, 0, 1], port).into();
let tcp_listener = tokio::net::TcpListener::bind(addr).await.unwrap();
let tcp_listener = tokio::net::TcpListener::bind(addr)
.await
.expect("failed to bind to local port");
println!("Listening on {addr}");
let h = tokio::spawn(async move { axum::serve(tcp_listener, router).await });
tokio::time::sleep(Duration::from_millis(100)).await;
Expand Down

0 comments on commit ec98b3a

Please sign in to comment.