Skip to content

Fix #35: Add macOS static package build - #36

Merged
samdark merged 4 commits into
masterfrom
issue-35-macos-package
Jun 1, 2026
Merged

Fix #35: Add macOS static package build#36
samdark merged 4 commits into
masterfrom
issue-35-macos-package

Conversation

@samdark

@samdark samdark commented May 30, 2026

Copy link
Copy Markdown
Member

Summary

  • add a native macOS static binary packaging script and make target
  • publish macOS artifacts from the Package Static Builds workflow
  • document macOS packaging and add packaging test coverage

Verification

Closes #35

Summary by CodeRabbit

  • New Features

    • Added macOS static binary packaging and Apple Silicon (arm64) releases, plus a macOS packaging target and CI job that builds, smoke-tests, and uploads macOS artifacts.
  • Documentation

    • README and deployment docs updated to list macOS among supported static binary platforms and packaging commands.
  • Tests

    • Packaging tests extended to cover macOS packaging flow, artifacts, and release packaging.
  • Bug Fixes

    • Fix to packaging helper to avoid erroneous failure after a successful patch.
  • Chores

    • Roadmap updated to include macOS packaging completion.

Copilot AI review requested due to automatic review settings May 30, 2026 11:32
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72207dc0-34ae-49bc-a2dc-56480cd4a310

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3110c and 3e465e5.

📒 Files selected for processing (3)
  • build/static-php/register-yiipress-highlighter.php
  • docs/deployment.md
  • tests/Unit/Packaging/ConfigurationPackagingTest.php

📝 Walkthrough

Walkthrough

Adds end-to-end macOS static packaging: a GitHub Actions macOS job, Makefile target, a bash packaging script to build an Apple Silicon static binary, extended unit tests, a small static-php patch, and documentation updates; release packaging now includes the macOS archive.

Changes

macOS Static Binary Packaging

Layer / File(s) Summary
GitHub Actions CI Job for macOS Builds
.github/workflows/package-static.yml
New macos job builds, caches, smoke-tests, archives yiipress-macos-arm64.tar.gz, uploads artifact; release now depends on macos and includes the macOS archive in release assets.
Makefile Build System Integration
Makefile
Adds PACKAGE_MACOS_ARCH, PACKAGE_MACOS_DIST, MACOS_PACKAGE_ARGS and a package-macos target that validates Bash and invokes build/package-macos.sh with --dist-dir/--arch.
Packaging script entry, args & helpers
build/package-macos.sh
Script entry with strict bash, arg parsing (--arch/--dist-dir), arch->Cargo target mapping, workspace/dist path setup, and helper functions for invocation, command checks, log tails, tar extraction, and path copying.
Staging app and PHAR creation
build/package-macos.sh
Stages app sources into a work dir, runs Composer to install deps, and generates the initial PHAR used for static packaging.
Download & build static deps and Rust highlighter
build/package-macos.sh
Conditionally downloads/unpacks static-php-cli and md4c, bootstraps highlighter via Composer, runs rustup target add and compiles the highlighter with cargo for the mapped target.
spc build, combine, and finalize binary
build/package-macos.sh
Patches static-php configs, runs spc download/doctor/build, prints log tails on failure, runs spc micro:combine, marks yiipress executable, and prints the built path.
Highlighter register patch validation
build/static-php/register-yiipress-highlighter.php
Fixes Windows highlighter config patch check to only throw when the expected EXTENSION(..., false); line is absent.
Test Validation of Build System and Artifacts
tests/Unit/Packaging/ConfigurationPackagingTest.php
Extends tests to assert Makefile macOS variables/target, load and inspect build/package-macos.sh, adds macosPackageScriptBuildsPharAndExecutable() asserting build steps and path handling, extends workflow publishing checks, and verifies rustup target addition; adjusts a Windows patch assertion.
User-Facing Documentation and Roadmap
README.md, docs/deployment.md, roadmap.md
Adds macOS to features list and maintainer packaging commands, documents make package-macos and macOS artifact publishing in deployment docs, and updates roadmap to include macOS packaging completion.

Sequence Diagram

sequenceDiagram
  participant Developer
  participant CI as GitHub Actions
  participant Makefile
  participant PackScript as build/package-macos.sh
  participant Composer
  participant Cargo
  participant Artifact as ActionsArtifact
  participant Release as release
  Developer->>Makefile: run `make package-macos` (local)
  CI->>Makefile: macos job runs `make package-macos`
  Makefile->>PackScript: invoke --dist-dir / --arch
  PackScript->>Composer: install deps / create PHAR
  PackScript->>Cargo: rustup target add & cargo build highlighter
  PackScript->>Artifact: create & pack yiipress-macos-arm64.tar.gz
  CI->>Artifact: upload artifact
  CI->>Release: release job waits for macos and copies artifact
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • yiipress/engine#33: Prior refactor of the static packaging workflow and Makefile that this change extends by adding macOS-specific jobs and targets.

Poem

🐰 I hopped through code on a moonlit track,
Built a macOS binary, packed it in a sack,
Composer hummed and Cargo sang, clang went the pack,
Apple Silicon sleeps wrapped in a tidy tarball stack,
Hooray — three platforms now bounce on my back!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add macOS static package build' accurately and concisely describes the main change: adding macOS static binary packaging capability to the project.
Linked Issues check ✅ Passed The PR successfully implements macOS binary building as required by issue #35, including the packaging script, Makefile target, GitHub Actions workflow, and test coverage.
Out of Scope Changes check ✅ Passed All changes are in scope: macOS packaging script, Makefile configuration, GitHub Actions workflow updates, documentation, tests, and roadmap updates directly support the macOS packaging objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-35-macos-package

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Adds native macOS static binary packaging alongside the existing PHAR, Linux, Windows, and distroless packaging paths.

Changes:

  • Adds a macOS packaging script and make package-macos target.
  • Extends the static package workflow to build, smoke test, upload, and release macOS artifacts.
  • Updates docs, roadmap, README, and packaging configuration tests for macOS support.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
build/package-macos.sh New Bash packaging flow for macOS static executable builds.
Makefile Adds macOS package variables and target.
.github/workflows/package-static.yml Adds macOS CI packaging job and release artifact handling.
tests/Unit/Packaging/ConfigurationPackagingTest.php Adds assertions covering macOS package configuration.
README.md Documents macOS static binary availability and package target.
docs/deployment.md Documents macOS packaging usage and artifact publication.
roadmap.md Marks macOS release packaging as included.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build/package-macos.sh
Comment thread .github/workflows/package-static.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
build/package-macos.sh (1)

93-103: ⚡ Quick win

Add a timeout and retry to the archive download.

curl -fsSL here has no time limit or retry, so a stalled connection to GitHub/PECL can hang the build indefinitely, and a transient failure aborts the whole job. The Windows packaging script already bounds its download (-TimeoutSec 300); mirror that here.

♻️ Proposed change
-    curl -fsSL "$url" -o "$archive"
+    curl -fsSL --max-time 300 --retry 3 --retry-delay 5 "$url" -o "$archive"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build/package-macos.sh` around lines 93 - 103, The download in
expand_tar_gz_archive uses curl without timeouts or retries; update the curl
invocation in function expand_tar_gz_archive to include a maximum time (e.g.,
--max-time or --connect-timeout) and a retry policy (e.g., --retry N and
optional --retry-delay or --retry-connrefused) so the download will fail fast on
stalls and retry transient errors; keep the rest of the function (mktemp, tar,
cleanup) intact and ensure the curl exit code still causes the script to fail if
all retries/timeouts are exhausted.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@build/package-macos.sh`:
- Around line 93-103: The download in expand_tar_gz_archive uses curl without
timeouts or retries; update the curl invocation in function
expand_tar_gz_archive to include a maximum time (e.g., --max-time or
--connect-timeout) and a retry policy (e.g., --retry N and optional
--retry-delay or --retry-connrefused) so the download will fail fast on stalls
and retry transient errors; keep the rest of the function (mktemp, tar, cleanup)
intact and ensure the curl exit code still causes the script to fail if all
retries/timeouts are exhausted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72ab7ab5-bd37-414a-b738-b3cca3ed2d86

📥 Commits

Reviewing files that changed from the base of the PR and between 6c64258 and 16cf43d.

📒 Files selected for processing (7)
  • .github/workflows/package-static.yml
  • Makefile
  • README.md
  • build/package-macos.sh
  • docs/deployment.md
  • roadmap.md
  • tests/Unit/Packaging/ConfigurationPackagingTest.php

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/deployment.md`:
- Line 170: Update the documentation line describing the macOS packaging
requirements for `make package-macos` to hyphenate the compound adjective:
change the phrase "Xcode command line build toolchain" to "Xcode command-line
build toolchain" in the sentence mentioning host requirements (the line
referencing `make package-macos`, `PACKAGE_MACOS_ARCH` and
`PACKAGE_MACOS_DIST`).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3f8243ca-fd99-4f82-bf4e-a30f45b3ec9e

📥 Commits

Reviewing files that changed from the base of the PR and between 16cf43d and 6c3110c.

📒 Files selected for processing (4)
  • .github/workflows/package-static.yml
  • build/package-macos.sh
  • docs/deployment.md
  • tests/Unit/Packaging/ConfigurationPackagingTest.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/package-static.yml
  • tests/Unit/Packaging/ConfigurationPackagingTest.php
  • build/package-macos.sh

Comment thread docs/deployment.md Outdated
@samdark samdark changed the title Add macOS static package build Fix #35: Add macOS static package build Jun 1, 2026
@samdark
samdark merged commit c28b446 into master Jun 1, 2026
6 of 7 checks passed
@samdark
samdark deleted the issue-35-macos-package branch June 1, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build binaries for MacOS

2 participants