From d8e57cc11757cb9e41437d535f167032ef5e0335 Mon Sep 17 00:00:00 2001 From: Angel M De Miguel Date: Thu, 19 Oct 2023 10:30:59 +0200 Subject: [PATCH 1/2] chore: fix all clippy suggestions on the new version --- crates/api-manage/src/models/worker_config.rs | 2 +- crates/project/src/lib.rs | 4 ++-- crates/runtimes/src/lib.rs | 2 +- crates/server/src/handlers/worker.rs | 14 ++++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/api-manage/src/models/worker_config.rs b/crates/api-manage/src/models/worker_config.rs index a0a97b51..3d06a4d5 100644 --- a/crates/api-manage/src/models/worker_config.rs +++ b/crates/api-manage/src/models/worker_config.rs @@ -42,7 +42,7 @@ impl From<&Worker> for WorkerConfig { .map(WorkerFolder::from) .collect::>() }) - .unwrap_or(Vec::new()); + .unwrap_or_default(); Self { id: value.id.clone(), diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rs index fa2fd3ae..f7ab9f1f 100644 --- a/crates/project/src/lib.rs +++ b/crates/project/src/lib.rs @@ -40,8 +40,8 @@ pub async fn prepare_project( force_type: Option, options: Options, ) -> Result { - let project_type = if force_type.is_some() { - force_type.unwrap() + let project_type = if let Some(new_type) = force_type { + new_type } else { identify_type(location)? }; diff --git a/crates/runtimes/src/lib.rs b/crates/runtimes/src/lib.rs index 967ea156..d3b8badc 100644 --- a/crates/runtimes/src/lib.rs +++ b/crates/runtimes/src/lib.rs @@ -1,4 +1,4 @@ -//// Copyright 2022 VMware, Inc. +// Copyright 2022-2023 VMware, Inc. // SPDX-License-Identifier: Apache-2.0 pub mod errors; diff --git a/crates/server/src/handlers/worker.rs b/crates/server/src/handlers/worker.rs index b54481a7..9cc94cf8 100644 --- a/crates/server/src/handlers/worker.rs +++ b/crates/server/src/handlers/worker.rs @@ -122,12 +122,14 @@ pub async fn handle_worker(req: HttpRequest, body: Bytes) -> HttpResponse { } // Write to the state if required - if handler_success && kv_namespace.is_some() { - data_connectors - .write() - .expect("error locking data connectors lock for writing") - .kv - .replace_store(&kv_namespace.unwrap(), &handler_result.kv) + if handler_success { + if let Some(kv_namespace) = kv_namespace { + data_connectors + .write() + .expect("error locking data connectors lock for writing") + .kv + .replace_store(&kv_namespace, &handler_result.kv) + } } match handler_result.body() { From e9c6b464c3f008d6a552951663ead28525456d09 Mon Sep 17 00:00:00 2001 From: Angel M De Miguel Date: Thu, 19 Oct 2023 13:02:51 +0200 Subject: [PATCH 2/2] feat: improve CI times and caching by avoiding incremental builds and debug info --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab35af7e..9a1fad7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,10 @@ on: branches: [ "main", "v[0-9]+.[0-9]+" ] env: + # Disabling debug info and incremental builds to speed up builds a bunch. + # See https://matklad.github.io/2021/09/04/fast-rust-builds.html#CI-Workflow + CARGO_INCREMENTAL: 0 + CARGO_PROFILE_DEV_DEBUG: 0 CARGO_TERM_COLOR: always jobs: @@ -70,5 +74,7 @@ jobs: run: make all - name: Build wws on release mode run: cargo build --verbose --release + - name: Compile test + run: cargo test --no-run --locked - name: Test run: cargo test --workspace -- --show-output