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.

perf(ci): build a deploy job's nix derivations in parallel (#7815)

Wolf Mermelstein4d8f55a6a661
diff --git a/.github/scripts/build-cloud-storage-lambdas-nix.sh b/.github/scripts/build-cloud-storage-lambdas-nix.sh
index df43ffd124..abc86eb04b 100755
--- a/.github/scripts/build-cloud-storage-lambdas-nix.sh
+++ b/.github/scripts/build-cloud-storage-lambdas-nix.sh
@@ -34,14 +34,15 @@ fi
echo "Building Lambda artifacts for $SERVICE via nix: ${LAMBDAS[*]}"
# Build every handler for this service in one nix invocation: independent
-# derivations build in parallel, unchanged ones are pure cache hits, and the
-# out paths are captured here (stdout) while build logs stream to stderr —
-# no per-handler re-invocation of nix.
+# derivations build in parallel (--max-jobs, since setup-nix's nix.conf leaves
+# the default of 1), unchanged ones are pure cache hits, and the out paths are
+# captured here (stdout) while build logs stream to stderr — no per-handler
+# re-invocation of nix.
installables=()
for lambda in "${LAMBDAS[@]}"; do
installables+=(".#deploy-lambda-${lambda}")
done
-mapfile -t outs < <(nix build --no-link --print-build-logs --print-out-paths "${installables[@]}")
+mapfile -t outs < <(nix build --max-jobs auto --no-link --print-build-logs --print-out-paths "${installables[@]}")
if [[ -n "${NIX_CACHE_URL:-}" && -n "${NIX_CACHE_SIGNING_KEY:-}" ]]; then
key="${RUNNER_TEMP:-/tmp}/nix-cache-signing-key"
diff --git a/.github/workflows/deploy_all_services.yml b/.github/workflows/deploy_all_services.yml
index 7c0245f493..2a4e862e90 100644
--- a/.github/workflows/deploy_all_services.yml
+++ b/.github/workflows/deploy_all_services.yml
@@ -200,7 +200,9 @@ jobs:
run: |
set -euo pipefail
mkdir -p prebuilt
- nix build --print-build-logs ".#deploy-service-binaries-${SERVICE}"
+ # DSS bundles two cargo packages; the hand-written nix.conf leaves
+ # max-jobs at 1, which would build them one after the other.
+ nix build --max-jobs auto --print-build-logs ".#deploy-service-binaries-${SERVICE}"
cp -r result/bin/* prebuilt/
mkdir -p prebuilt/nix-store
while IFS= read -r store_path; do
diff --git a/.github/workflows/reusable_deploy_service.yml b/.github/workflows/reusable_deploy_service.yml
index 0a9b0db615..d129102ef0 100644
--- a/.github/workflows/reusable_deploy_service.yml
+++ b/.github/workflows/reusable_deploy_service.yml
@@ -90,7 +90,9 @@ jobs:
run: |
set -euo pipefail
mkdir -p prebuilt
- nix build --print-build-logs ".#deploy-service-binaries-${SERVICE}"
+ # DSS bundles two cargo packages; the hand-written nix.conf leaves
+ # max-jobs at 1, which would build them one after the other.
+ nix build --max-jobs auto --print-build-logs ".#deploy-service-binaries-${SERVICE}"
cp -r result/bin/* prebuilt/
mkdir -p prebuilt/nix-store
while IFS= read -r store_path; do
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_all_services.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_all_services.rs
index 85aa5ca1b4..7c5f30ea41 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_all_services.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_all_services.rs
@@ -227,7 +227,9 @@ fn build_prebuilt_binaries() -> Step<Run> {
let script = indoc::indoc! {r#"
set -euo pipefail
mkdir -p prebuilt
- nix build --print-build-logs ".#deploy-service-binaries-${SERVICE}"
+ # DSS bundles two cargo packages; the hand-written nix.conf leaves
+ # max-jobs at 1, which would build them one after the other.
+ nix build --max-jobs auto --print-build-logs ".#deploy-service-binaries-${SERVICE}"
cp -r result/bin/* prebuilt/
mkdir -p prebuilt/nix-store
while IFS= read -r store_path; do
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/reusable_deploy_service.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/reusable_deploy_service.rs
index d39909de87..a8e232ef89 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/reusable_deploy_service.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/reusable_deploy_service.rs
@@ -135,7 +135,9 @@ fn build_prebuilt_binaries() -> Step<Run> {
let script = indoc::indoc! {r#"
set -euo pipefail
mkdir -p prebuilt
- nix build --print-build-logs ".#deploy-service-binaries-${SERVICE}"
+ # DSS bundles two cargo packages; the hand-written nix.conf leaves
+ # max-jobs at 1, which would build them one after the other.
+ nix build --max-jobs auto --print-build-logs ".#deploy-service-binaries-${SERVICE}"
cp -r result/bin/* prebuilt/
mkdir -p prebuilt/nix-store
while IFS= read -r store_path; do