Skip to content

Adopt multi-package macOS benchmarks workflow#466

Merged
rnro merged 2 commits into
apple:mainfrom
rnro:single_benchmarks_job
May 21, 2026
Merged

Adopt multi-package macOS benchmarks workflow#466
rnro merged 2 commits into
apple:mainfrom
rnro:single_benchmarks_job

Conversation

@rnro

@rnro rnro commented May 20, 2026

Copy link
Copy Markdown
Contributor

Motivation

  • The two-invocation pattern for macos-benchmarks and macos-benchmarks-MaxLogLevelWarningBenchmarks-trait allocates one self-hosted macOS runner per (Swift version x package), incurring duplicate runner-recycling cost.
  • The recent change on main adds a benchmark_package_paths input letting a single invocation run all packages serially on each runner.

Modifications

  • Replace the two macOS benchmark jobs in main.yml and pull_request.yml with a single consolidated job that passes both packages via benchmark_package_paths: '["Benchmarks/NoTraits", "Benchmarks/MaxLogLevelWarning"]'.
  • Drop Swift 6.2 from the matrix; only Swift 6.3 is shared between the two packages (MaxLogLevelWarning has no Thresholds/Xcode swift 6.2/).

Result

  • One macOS runner allocation per Swift version instead of one per (version x package).
  • NoTraits loses Swift 6.2 coverage

@rnro
rnro force-pushed the single_benchmarks_job branch from 1c748d2 to fc54526 Compare May 20, 2026 20:35
@rnro rnro closed this May 20, 2026
@rnro rnro reopened this May 20, 2026
rnro added a commit to apple/swift-nio that referenced this pull request May 21, 2026
)

### Motivation

* External callers of `macos_benchmarks.yml` (e.g. swift-log) currently
invoke the reusable workflow once per benchmark package, paying
self-hosted macOS runner-recycling cost for each invocation.

### Modifications

* Add a new `benchmark_package_paths` input to
`.github/workflows/macos_benchmarks.yml` and mark the singular
`benchmark_package_path` as deprecated. The run step forwards both
inputs straight to the script via `BENCHMARK_PACKAGE_PATH` and
`BENCHMARK_PACKAGE_PATHS` environment variables; the workflow itself
does no path parsing.
* Teach `scripts/check_benchmark_thresholds.sh` to accept
`BENCHMARK_PACKAGE_PATHS` as either a JSON array of strings
(auto-detected by a leading `[`, requires `jq`) or a newline-separated
list, falling back to the legacy `BENCHMARK_PACKAGE_PATH` when unset or
when the JSON form is an empty array.
* The script now loops over the resolved package list, wraps each
iteration in a GitHub Actions `::group::`, and emits an `::error::`
summary listing failed packages at the end, exiting non-zero if any
failed.

### Result

* A single workflow invocation runs all listed packages serially on each
Swift/Xcode runner, paying runner-recycling cost once per Swift version
instead of once per (version x package).
* Existing single-package callers keep working unchanged.
* Adopters of the script in other contexts (e.g. the Linux
`benchmarks.yml`) can pick up multi-package support by passing
`BENCHMARK_PACKAGE_PATHS` without reimplementing parsing or
failure-collection logic.

An example of this working apple/swift-log#466
Motivation

* The current pattern chains a separate `macos-benchmarks-*` workflow invocation per package (`NoTraits`, `MaxLogLevelWarning`, `MaxLogLevelNone`), allocating one self-hosted macOS runner per (Swift version x package) and paying runner-recycling cost for each.
* `apple/swift-nio`'s `macos_benchmarks.yml` now exposes a `benchmark_package_paths` input that runs multiple packages serially on a single runner allocation per Swift version.

Modifications

* Replace the three macOS benchmark jobs in `main.yml` and `pull_request.yml` with a single consolidated job using `benchmark_package_paths: '["Benchmarks/NoTraits", "Benchmarks/MaxLogLevelWarning", "Benchmarks/MaxLogLevelNone"]'`.
* Drop Swift 6.2 from the matrix; only Swift 6.3 is shared between all three packages (`MaxLogLevelWarning` and `MaxLogLevelNone` have no `Thresholds/Xcode swift 6.2/`).

Result

* One macOS runner allocation per Swift version instead of one per (version x package).
* `NoTraits` loses Swift 6.2 coverage; revisit once the other packages gain `Xcode swift 6.2` thresholds or 6.2 is dropped repo-wide.
@rnro
rnro force-pushed the single_benchmarks_job branch from fc54526 to 58c1c8a Compare May 21, 2026 13:19
@rnro
rnro marked this pull request as ready for review May 21, 2026 14:00
@rnro
rnro requested a review from kukushechkin May 21, 2026 14:00
@rnro rnro added the semver/none No version bump required. label May 21, 2026
Comment thread .github/workflows/main.yml
@rnro
rnro enabled auto-merge (squash) May 21, 2026 14:11
@rnro
rnro merged commit a012e0a into apple:main May 21, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants