Skip to content

build: cross-compile and pack release artifacts concurrently - #599

Merged
fforootd merged 4 commits into
mainfrom
claude/parallel-release-builds
Jul 22, 2026
Merged

build: cross-compile and pack release artifacts concurrently#599
fforootd merged 4 commits into
mainfrom
claude/parallel-release-builds

Conversation

@fforootd

Copy link
Copy Markdown
Member

Summary

  • buildServerBinaries compiled the 5 server platforms strictly in sequence and packPublicPackages packed the 19 public packages one by one. Both loops are independent per item, so they now run through a new mapWithConcurrency helper in scripts/dev-process.mjs (order-preserving results, no new work started after a failure, in-flight children awaited).
  • All 5 go builds run at once — the Go build cache is concurrency-safe; the win comes from overlapping the serial link phases. Measured locally with a cold cache: 1m56 → 1m33 (~20%); warm-cache runs (the CI norm with the restored setup-go cache) save proportionally more.
  • pnpm pack runs with concurrency 8 into the shared tarballs dir (distinct filenames; the @zitadel/cli prepack rebuild keeps its production telemetry-channel stamp).
  • This shortens the release-artifact build step every full PR pays (and the publish/build job), independent of the pipeline rework in ci: rehearsable, promote-only release pipeline with build/publish job split #487 — which merges over this cleanly since it doesn't touch these function bodies.

Validation

  • moon run release:pack then node apps/cli-journey-e2e/scripts/verify-tarballs.mjs dist/release/<v>/npm — 19 installable tarballs verified
  • Cold-cache timing A/B via direct buildServerBinaries invocation (go clean -cache before each): sequential 1m55.9s, parallel 1m32.8s
  • vitest run tests/unit/scripts/dev-process.test.ts tests/unit/scripts/release-artifacts.test.ts — 12 tests green (new coverage: order preservation, concurrency cap, fail-fast semantics, empty input)
  • moon run cli:lint — clean

Release notes / changeset

  • No changeset required — no shipped behavior changed (release build scripts and tests only; no publishable package source is touched).

Notes

  • Failure semantics are deliberately "finish in-flight, start nothing new": spawned go/pnpm children cannot be abandoned safely, so a failing platform/package surfaces after the current lane items settle, with the first error rethrown.
  • Log lines from concurrent packs interleave; Moon already interleaves parallel task output, so this matches the existing CI log shape.

buildServerBinaries compiled the 5 server platforms strictly in
sequence and packPublicPackages packed the 19 public packages one by
one. Both loops are independent per item, so run them through a new
mapWithConcurrency helper (order-preserving results, no new work after
a failure, in-flight children awaited):

- all 5 go builds run at once - the Go build cache is
  concurrency-safe, and the win comes from overlapping the serial
  link phases (~20% faster on a cold cache: 1m56 -> 1m33 locally;
  proportionally more with a warm cache)
- pnpm pack runs with concurrency 8 into the shared tarballs dir
  (distinct filenames; the cli prepack rebuild keeps its production
  telemetry-channel stamp)

Validated with moon run release:pack plus verify-tarballs (19
installable tarballs) and new unit coverage for the helper.
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nextgen Ready Ready Preview, Comment Jul 22, 2026 3:30pm
nextgen-docs Ready Ready Preview, Comment Jul 22, 2026 3:30pm
nextgen-mock-zitadel Ready Ready Preview, Comment Jul 22, 2026 3:30pm

Request Review

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: 79a4265

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR speeds up release artifact generation by introducing a reusable concurrency-limited async mapper and applying it to parallelize Go cross-compilation and npm package packing in the release scripts.

Changes:

  • Added mapWithConcurrency helper to run async work with a concurrency cap while preserving input order and stopping new work after the first failure.
  • Updated buildServerBinaries to compile all configured server platforms concurrently.
  • Updated packPublicPackages to pack public packages concurrently (cap 8) into the shared tarballs directory.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
scripts/release-artifacts.mjs Switched platform builds and public package packing from sequential loops to concurrency-limited mapping.
scripts/dev-process.mjs Added mapWithConcurrency helper implementing order-preserving, fail-fast, concurrency-limited async mapping.
apps/cli/tests/unit/scripts/dev-process.test.ts Added unit tests for mapWithConcurrency (ordering, concurrency cap, fail-fast semantics, empty input).

Comment thread scripts/dev-process.mjs
fforootd added 2 commits July 22, 2026 17:24
A NaN limit produced zero worker lanes via Array.from({length: NaN}),
so the call returned an all-undefined result array without running any
work - a silent no-op. Validate the limit as a positive integer and
early-return on empty input. Addresses the Copilot review finding on
#599.
@fforootd
fforootd merged commit fef9d71 into main Jul 22, 2026
14 checks passed
@fforootd
fforootd deleted the claude/parallel-release-builds branch July 22, 2026 15:39
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants