diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0604ee4a77..cf7f110109 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,8 @@ jobs: release-arch: amd64 env: RUST_BACKTRACE: full + # Force not building debuginfo to save space on disk. + RUSTFLAGS: "-C debuginfo=0" RUSTC_WRAPPER: sccache RUSTV: ${{ matrix.rust }} SCCACHE_CACHE_SIZE: 2G @@ -135,7 +137,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: check - args: --all --bins --tests --examples + args: --workspace --all-features --bins --tests --examples --benches - name: tests uses: actions-rs/cargo@v1 @@ -145,17 +147,17 @@ jobs: # GHA if this is not present # https://twitter.com/steipete/status/921066430220652544?lang=en # https://blog.phusion.nl/2017/10/13/why-ruby-app-servers-break-on-macos-high-sierra-and-what-can-be-done-about-it/ - OBJC_DISABLE_INITIALIZE_FORK_SAFETY: YES + OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES" with: command: test - args: --all -j 4 + args: -j 2 --workspace --all-features --examples --benches --bins - - name: clipy + - name: clippy uses: actions-rs/cargo@v1 if: matrix.os == 'ubuntu-latest' && matrix.rust=='stable' with: - command: clippy - args: --all --tests --benches --all-targets -- -D warnings + command: clippy + args: --workspace --all-features --tests --benches --examples --bins --all-targets -- -D warnings - name: build release uses: actions-rs/cargo@v1 @@ -257,4 +259,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: fmt - args: --all -- --check \ No newline at end of file + args: --all -- --check diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 040874a620..6b69022345 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -81,15 +81,15 @@ When you push your branch to github and open up a pull request, it will automati In order to catch linting and testing errors before pushing the code to github, be sure to run: ```shell -$ cargo clippy --workspace --examples --benches --tests -$ cargo test --workspace --examples --benches +$ cargo clippy --workspace --all-features --examples --benches --tests --bins +$ cargo test --workspace --all-features --examples --benches --bins ``` Setting up a [git hook][git-hook] to run these commands can save you many headaches: ```shell #!/bin/sh -cargo clippy --workspace --examples --tests --benches && cargo test --workspace --examples +cargo clippy --workspace --all-features --examples --benches --tests --bins && cargo test --workspace --all-features --examples --benches --bins ``` ## Dependencies diff --git a/iroh-metrics/src/config.rs b/iroh-metrics/src/config.rs index 1ff4f25c7c..42f0c03285 100644 --- a/iroh-metrics/src/config.rs +++ b/iroh-metrics/src/config.rs @@ -133,7 +133,7 @@ mod tests { #[cfg(feature = "tokio-console")] expect.insert( "tokio_console".to_string(), - Value::new(None, cfg.tokio_console.clone()), + Value::new(None, cfg.tokio_console), ); let got = cfg.collect().unwrap(); for key in got.keys() { diff --git a/iroh-one/Cargo.toml b/iroh-one/Cargo.toml index ac43ff3475..37fad30c64 100644 --- a/iroh-one/Cargo.toml +++ b/iroh-one/Cargo.toml @@ -29,6 +29,7 @@ iroh-store = {path = "../iroh-store", default-features = false, features = ["rpc iroh-util = {path = "../iroh-util"} reqwest = {version = "0.11", features = ["rustls-tls"], default-features = false} serde = {version = "1.0", features = ["derive"]} +tempfile = { version = "3.3.0", optional = true } tokio = {version = "1", features = ["macros", "rt-multi-thread", "process"]} tracing = "0.1.33" @@ -41,4 +42,4 @@ rpc-grpc = ["iroh-rpc-types/grpc", "iroh-rpc-client/grpc", "iroh-metrics/rpc-grp rpc-mem = ["iroh-rpc-types/mem", "iroh-rpc-client/mem"] # uds-gateway controls whether http over uds is enabled. This is independent of the # rpc-grpc control endpoint. -uds-gateway = [] +uds-gateway = ["tempfile"] diff --git a/iroh-one/src/config.rs b/iroh-one/src/config.rs index 535ec7e92c..64b348e1c8 100644 --- a/iroh-one/src/config.rs +++ b/iroh-one/src/config.rs @@ -62,7 +62,9 @@ impl Config { /// as a single entry point for other system services if feature enabled. pub fn default_rpc_config() -> RpcClientConfig { #[cfg(feature = "uds-gateway")] - let path: PathBuf = tempdir::TempDir::new("iroh") + let path: PathBuf = tempfile::Builder::new() + .prefix("iroh") + .tempfile() .unwrap() .path() .join("ipfsd.http"); @@ -93,7 +95,12 @@ impl Config { impl Default for Config { fn default() -> Self { #[cfg(feature = "uds-gateway")] - let gateway_uds_path: PathBuf = TempDir::new("iroh").unwrap().path().join("ipfsd.http"); + let gateway_uds_path: PathBuf = tempfile::Builder::new() + .prefix("iroh") + .tempfile() + .unwrap() + .path() + .join("ipfsd.http"); let rpc_client = Self::default_rpc_config(); let metrics_config = MetricsConfig::default(); let store_config = diff --git a/iroh-one/src/main.rs b/iroh-one/src/main.rs index 1cfa3a74eb..d22d11ff2d 100644 --- a/iroh-one/src/main.rs +++ b/iroh-one/src/main.rs @@ -15,8 +15,6 @@ use iroh_rpc_client::Client as RpcClient; use iroh_rpc_types::Addr; use iroh_util::lock::ProgramLock; use iroh_util::{iroh_config_path, make_config}; -#[cfg(feature = "uds-gateway")] -use tempdir::TempDir; use tokio::sync::RwLock; #[tokio::main(flavor = "multi_thread")] @@ -109,14 +107,18 @@ async fn main() -> Result<()> { #[cfg(feature = "uds-gateway")] let uds_server_task = { - let mut path = TempDir::new("iroh")?.path().join("ipfsd.http"); + let mut path = tempfile::Builder::new() + .prefix("iroh") + .tempdir()? + .path() + .join("ipfsd.http"); if let Some(uds_path) = config.gateway_uds_path { path = uds_path; } else { // Create the parent path when using the default value since it's likely // it won't exist yet. if let Some(parent) = path.parent() { - let _ = std::fs::create_dir_all(&parent); + let _ = std::fs::create_dir_all(parent); } } diff --git a/iroh-one/src/uds.rs b/iroh-one/src/uds.rs index c48b578856..3272dd2a3f 100644 --- a/iroh-one/src/uds.rs +++ b/iroh-one/src/uds.rs @@ -8,7 +8,7 @@ use hyper::{ server::accept::Accept, }; use iroh_gateway::{core::State, handlers::get_app_routes}; -use iroh_resolver::resolver::ContentLoader; +use iroh_resolver::content_loader::ContentLoader; use std::path::PathBuf; use std::{ io, diff --git a/iroh-share/Cargo.toml b/iroh-share/Cargo.toml index c5208497c9..b969e64b35 100644 --- a/iroh-share/Cargo.toml +++ b/iroh-share/Cargo.toml @@ -26,7 +26,7 @@ libp2p = { version = "0.50", default-features = false, features = ["gossipsub"] multibase = "0.9.1" rand = "0.8.5" serde = { version = "1", features = ["derive"] } -tempfile = "3.3" +tempfile = "3.3.0" tokio = { version = "1" } tokio-stream = "0.1.9" tracing = "0.1.34"