Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

build(document_storage_service): compile the library once in tests (#9849)

teo765ed7ad3c9e
diff --git a/.github/workflows/code_check_cloud_storage.yml b/.github/workflows/code_check_cloud_storage.yml
index 043c6cfa40..62e69daf8b 100644
--- a/.github/workflows/code_check_cloud_storage.yml
+++ b/.github/workflows/code_check_cloud_storage.yml
@@ -867,9 +867,9 @@ jobs:
# The filterset only decides which tests *run* after a workspace build; `-p`
# is what keeps an unrelated crate's test binary from being compiled.
#
- # `--lib --bins --tests` is safe with `--workspace` (cargo skips packages that
- # lack a given target type) but fails with `-p` when any selected package has
- # no lib — xtask binaries such as xtask_nextest_filter / xtask_workflows.
+ # `--tests` with `--workspace` builds the test binary of every target with
+ # `test = true`. `--bins` would also build the bins that opt out, and the normal
+ # library beneath them.
# Unconstrained `-p` still runs that package's tests.
: "${RUST_PACKAGES:?RUST_PACKAGES is required}"
@@ -894,7 +894,7 @@ jobs:
fi
if [ "$RUST_PACKAGES" = "all" ]; then
- cargo nextest run --workspace --exclude sync_service --lib --bins --tests "${common[@]}"
+ cargo nextest run --workspace --exclude sync_service --tests "${common[@]}"
exit 0
fi
@@ -928,9 +928,9 @@ jobs:
# The filterset only decides which tests *run* after a workspace build; `-p`
# is what keeps an unrelated crate's test binary from being compiled.
#
- # `--lib --bins --tests` is safe with `--workspace` (cargo skips packages that
- # lack a given target type) but fails with `-p` when any selected package has
- # no lib — xtask binaries such as xtask_nextest_filter / xtask_workflows.
+ # `--tests` with `--workspace` builds the test binary of every target with
+ # `test = true`. `--bins` would also build the bins that opt out, and the normal
+ # library beneath them.
# Unconstrained `-p` still runs that package's tests.
: "${RUST_PACKAGES:?RUST_PACKAGES is required}"
@@ -955,7 +955,7 @@ jobs:
fi
if [ "$RUST_PACKAGES" = "all" ]; then
- cargo nextest run --workspace --exclude sync_service --lib --bins --tests "${common[@]}"
+ cargo nextest run --workspace --exclude sync_service --tests "${common[@]}"
exit 0
fi
diff --git a/services/document_storage_service/Cargo.toml b/services/document_storage_service/Cargo.toml
index c7af1ab067..a9efddf15f 100644
--- a/services/document_storage_service/Cargo.toml
+++ b/services/document_storage_service/Cargo.toml
@@ -5,17 +5,25 @@ name = "document_storage_service"
publish = false
version = "0.1.0"
+# The bins hold no tests and the library no doctests. Neither target builds under
+# `cargo test`, so the test job compiles the library once, as its test binary.
+[lib]
+doctest = false
+
[[bin]]
name = "document_storage_service"
path = "src/main.rs"
+test = false
[[bin]]
name = "document_storage_service_openapi"
path = "src/openapi.rs"
+test = false
[[bin]]
name = "document_storage_service_doppler_config"
path = "src/doppler_config.rs"
+test = false
[features]
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/run_tests.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/run_tests.sh
index 152577051d..b885f9215f 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/run_tests.sh
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/run_tests.sh
@@ -9,9 +9,9 @@ set -euo pipefail
# The filterset only decides which tests *run* after a workspace build; `-p`
# is what keeps an unrelated crate's test binary from being compiled.
#
-# `--lib --bins --tests` is safe with `--workspace` (cargo skips packages that
-# lack a given target type) but fails with `-p` when any selected package has
-# no lib — xtask binaries such as xtask_nextest_filter / xtask_workflows.
+# `--tests` with `--workspace` builds the test binary of every target with
+# `test = true`. `--bins` would also build the bins that opt out, and the normal
+# library beneath them.
# Unconstrained `-p` still runs that package's tests.
: "${RUST_PACKAGES:?RUST_PACKAGES is required}"
@@ -36,7 +36,7 @@ else
fi
if [ "$RUST_PACKAGES" = "all" ]; then
- cargo nextest run --workspace --exclude sync_service --lib --bins --tests "${common[@]}"
+ cargo nextest run --workspace --exclude sync_service --tests "${common[@]}"
exit 0
fi