# Task: add automated macOS releases to rust_realease Implement this task in the **rust_realease** repository. The spelling is intentional. Deliver working code, regression tests, configuration examples, and documentation, not just a proposal. ## Outcome Allow a Linux release host to build, package, and publish these additional targets through the existing release workflow: - `aarch64-apple-darwin` — Apple Silicon. - `x86_64-apple-darwin` — Intel. Use the verified containerized `cargo-zigbuild` route for Apple targets. Preserve the existing Linux/Windows build routes and release behavior. A mixed four-target release must work unattended after the container engine is provisioned, including token-free compile-only operation. ## Evidence and reference implementation The downstream project is `tiny-wb`. Its reference implementation was committed as `8ed07cb` (`feat: automate macOS cross-compilation with Zig`). In a tiny-wb checkout, inspect: - `scripts/build-macos.sh`: tested container invocation and image pin. - `scripts/test-macos-build.py`: wrapper regression tests. - `docs/macos.md`: toolchain details, output inspection, and limitations. - `rust-release.toml`, `release.sh`, and `release/Cross.toml`: existing publisher integration and Linux/Windows configuration. - `Cargo.toml`: cargo-binstall naming contract. - `docs/releases.md`: packaging and publication expectations. Both Apple default-feature release binaries were built on Linux using rootless Podman. A separate build also compiled and linked all tests and examples with all features for both targets. The maintainer subsequently reported that testing worked flawlessly. This is user-reported runtime success; exact macOS versions, CPU architectures tested, and hardware test cases were not supplied. Do not turn that report into claims of exhaustive platform/hardware coverage. The verified environment is: ```text image: ghcr.io/rust-cross/cargo-zigbuild@sha256:9b4f6b3eb9e8f9fefb3960fe288ddba576627d66d9eff851ce7f62d2455564a5 Rust: 1.93.0 cargo-zigbuild: 0.23.4 Zig: 0.16.0 SDKROOT: /opt/MacOSX11.3.sdk MACOSX_DEPLOYMENT_TARGET: 13.0 ``` The image supplies the Apple Rust targets and SDK, including IOKit and CoreFoundation used by `serialport`. No new tiny-wb Cargo dependencies were needed. The resulting binaries load only Apple system libraries/frameworks. Requesting macOS 11.0 with this image still emitted a Mach-O minimum of 13.0; use 13.0 explicitly and verify artifact headers. The SDK directory version does not establish the deployment minimum. The essential build command inside that container is: ```console cargo zigbuild --locked --release --bin tiny-wb --target aarch64-apple-darwin --target x86_64-apple-darwin ``` Generalize package, binary, profile, features, paths, and lock policy from rust_realease's existing settings. Do not hard-code tiny-wb into the publisher. ## Implementation requirements 1. Read the repository's contributor instructions and inspect current config, CLI, planning, build, cache, packaging, and verification code before editing. Reuse its architecture and terminology. The downstream notes describe a previous inspection, not a guarantee of current upstream internals. 2. Add typed, validated Apple build settings where needed. Keep existing config files compatible, reject invalid supplied settings with actionable errors, and avoid making Apple targets mandatory for every existing consumer. Prefer an explicit target selection and a documented default backend mapping. Show the exact supported TOML/CLI syntax in the finished documentation. 3. Route Apple builds to the pinned Zig container. Retain existing Cross behavior for Linux/Windows, including downstream `CROSS_CONFIG` handling. Do not require Darwin Cross images or an Xcode installation on the Linux host. 4. Support Docker and rootless Podman through the publisher's existing engine selection conventions. Handle paths with spaces and invocation outside the checkout. Preserve caller ownership of outputs, use writable cache paths, avoid interactive flags, and return build failures without reporting success. Never mount a container-engine socket into the compiler container. 5. Honor package/binary selection, feature flags, profile, and locked builds. Keep target outputs distinct. Include the backend, image digest, deployment minimum, and other effective build settings in cache identity so incompatible artifacts cannot be silently reused. Preserve explicit rebuild behavior. 6. Keep publishing credentials out of compiler arguments, logs, and container environments. Compile-only operation must not require a token or contact release APIs. Preserve existing dry-run guarantees and collision checks. 7. Feed Apple binaries into the existing archive, standalone executable, checksum, and upload pipeline. Retain executable permissions and the cargo-binstall archive layout. Apple executables have no `.exe` suffix. Do not create a separate ad hoc publisher. 8. Make verification target-aware. A Linux host cannot directly execute a Mach-O binary: inspect architecture, deployment minimum, dynamic dependencies, archive contents, and checksums locally. Record runtime checks as skipped when no compatible runner exists; do not silently count them as passed. Ensure installation verification does not try to execute foreign binaries. 9. Update prerequisite/error messages, architecture documentation, release examples, and tests. Document SDK provenance and the pinned build environment. Keep universal binaries, `.app` bundles, Developer ID signing, notarization, and support below macOS 13 outside this task. ## Downstream contract to demonstrate Provide a working configuration example selecting these four targets: ```text x86_64-unknown-linux-gnu x86_64-pc-windows-gnu aarch64-apple-darwin x86_64-apple-darwin ``` For tiny-wb, preserve `profile = "release"`, `locked = true`, unprefixed version tags, and its Gitea destination/token configuration. Read the package version from Cargo metadata rather than fixing it to the version used during testing. For a package version represented by `{version}`, the new assets must be: ```text tiny-wb-aarch64-apple-darwin-v{version}.tgz tiny-wb-aarch64-apple-darwin-v{version} tiny-wb-x86_64-apple-darwin-v{version}.tgz tiny-wb-x86_64-apple-darwin-v{version} ``` Each archive contains `tiny-wb-{target}-v{version}/tiny-wb`. Include the new archives and standalone binaries in the existing `SHA256SUMS`. A four-target release using both artifact formats therefore has eight payload assets plus the checksum file. The desired downstream entry point remains `./release.sh --compile-only`, with macOS selected in the publisher configuration. The standalone `build-macos.sh` is a reference implementation, not a required extra manual release step. If the tiny-wb checkout is outside this agent's authorized workspace, supply its exact configuration changes as a patch/example rather than modifying it. ## Verification and acceptance - Add focused tests for backend routing in a mixed target plan, configuration compatibility/validation, container arguments, ownership and path handling, credential exclusion, failure propagation, cache invalidation, archive contents/permissions, naming, and checksum inclusion. - Test compile-only and dry-run behavior without real publishing credentials. Exercise existing release/upload behavior through local fixtures or mocks. Preserve regression coverage for Linux and Windows. - Run all quality gates required by rust_realease's own contributor instructions. - Perform real compile-only Zig builds for both Apple targets with the pinned image, preferably using tiny-wb because it exercises system frameworks. Inspect both Mach-O files and packaged outputs. Run the mixed four-target compile-only workflow when its toolchains are available; report any unavailable checks explicitly instead of substituting a mock result for a real build. - Verify a second build can reuse valid caches and changed build inputs cannot reuse incompatible artifacts. - Report the exact commands, results, artifact paths, and remaining external checks, along with the final downstream configuration. Do not publish a release, upload assets, change remote tags, push commits, start shared Jenkins jobs, or install/replace the user's global publisher as part of this task. Follow the repository's commit policy and leave a reviewable implementation with no generated binaries, credentials, or caches committed.