Skip to content

feat(packaging): add macOS release builds, Homebrew tap support, and Windows service/MSI#216

Open
CraZySacX wants to merge 14 commits into
masterfrom
199-post-141-mainetenance
Open

feat(packaging): add macOS release builds, Homebrew tap support, and Windows service/MSI#216
CraZySacX wants to merge 14 commits into
masterfrom
199-post-141-mainetenance

Conversation

@CraZySacX
Copy link
Copy Markdown
Member

@CraZySacX CraZySacX commented May 31, 2026

Summary

macOS (previous commits)

  • Add native aarch64-apple-darwin build job for bartoc and barto-cli on macos-latest (Apple Silicon runner)
  • Add Homebrew formula templates (packaging/homebrew/bartoc.rb.tmpl, packaging/homebrew/barto-cli.rb.tmpl) with brew services / launchd integration for bartoc
  • Add update-homebrew CI job that computes SHA256 checksums and pushes generated formulas to the rustyhorde/homebrew-barto tap on each release
  • Update pre-release and release jobs to collect macOS tarballs alongside existing Linux assets
  • Also includes: v1.4.9 version bump, DEB/RPM bartoc post-install fix, AUR PKGBUILD gdb-add-index suppression

Windows service/MSI (previous commits)

  • bartoc/src/service.rs — new Windows-only SCM dispatcher using the windows-service crate; clean stop via CancellationToken propagation
  • --service flag activates SCM dispatch mode; without it, console behavior is unchanged on all platforms
  • bartoc/src/runtime/mod.rsrun() gains service_token parameter so an SCM Stop cancels the retry loop and per-connection tokens; load_windows_credentials() reads secrets from Windows Credential Manager at startup (mirrors bartoc-launcher.ps1)
  • bartoc/src/main.rs — removes #[tokio::main]; checks argv for --service before building the tokio runtime
  • bartoc/src/db/mod.rscreate_dir_all on the redb parent path so %ProgramData%\bartoc\ is created on first run
  • bartoc/wix/main.wxs — WiX 3.x MSI installer: binary to %ProgramFiles%\barto\bartoc\, delayed-auto-start service with restart-on-failure, example config to %ProgramData%\bartoc\
  • packaging/wix/README.Windows.md — setup guide: MSI install, dedicated service account, secret management, manual sc create
  • .github/workflows/release.yml — new build-windows job (MSVC target, cargo-wix); pre-release and release jobs include Windows .exe and .msi artifacts
  • .github/workflows/barto.yml — clippy-windows target changed to x86_64-pc-windows-msvc (required for windows-service linker)
  • Workspace deps: keyring-core 1.0.0, windows-native-keyring-store 1.1.0, windows-service 0.8.1

Nightly clippy fixes and PowerShell CI scripts (previous commits)

  • bartoc/src/runtime/mod.rs — wrap std::env::set_var in unsafe block (required by Rust 2024 edition); add #[allow(unsafe_code)] to load_windows_credentials; move const items before the match statement to fix items_after_statements
  • bartoc/src/service.rs — gate allow(non_exhaustive_omitted_patterns) on all(feature = "unstable", nightly) to match the deny condition; ServiceControl is #[non_exhaustive] from an external crate so a wildcard arm alone doesn't satisfy the lint
  • scripts/run_all.ps1 — PowerShell port of scripts/run_all.fish; uses param() switches (-NoTest, -NoCoverage, -NoDocs, -NoInstall, -NoMusl, -Unstable, -Clean) and $PSScriptRoot for sibling script discovery
  • scripts/run_install.ps1 — PowerShell port of scripts/run_install.fish
  • scripts/run_musl.ps1 — PowerShell port of scripts/run_musl.fish; adapted for Windows Docker Desktop (drops sudo chown, uses $env:USERPROFILE paths, invokes docker via arg array)

CI fix: cargo-wix MSI generation (previous commit)

  • .github/workflows/release.yml — replace --bin-path target\x86_64-pc-windows-msvc\release with --target x86_64-pc-windows-msvc; --bin-path is the WiX Toolset compiler directory flag, not the Rust binary output path — candle/light are already in PATH on windows-latest

WiX XML fix (previous commit)

  • bartoc/wix/main.wxs — remove --service from inside an XML comment; the XML spec forbids -- within comments, causing WiX candle to abort with exit code 104

Expose candle errors in CI (latest commit)

  • .github/workflows/release.yml — add --nocapture to the cargo wix invocation so candle/light output streams directly to CI logs; the previous -e WixUtilExtension attempt was incorrect (WixUtilExtension is included by default by cargo-wix) and has been reverted

Prerequisites before first release

  • Create rustyhorde/homebrew-barto GitHub repo with a Formula/ directory
  • Create a fine-grained PAT (barto-homebrew-tap-push) scoped to rustyhorde/homebrew-barto with Contents: Read and write
  • Add PAT as HOMEBREW_TAP_TOKEN secret in rustyhorde/barto

Test plan

macOS

  • Verify build-macos job succeeds on an RC tag push and uploads both .tar.gz artifacts
  • After a full release tag, verify update-homebrew pushes bartoc.rb and barto-cli.rb to the tap
  • On Apple Silicon Mac: brew tap rustyhorde/barto && brew install rustyhorde/barto/bartoc && bartoc --version
  • Confirm brew services start bartoc loads the launchd plist

Windows

  • Verify build-windows job succeeds on an RC tag push and uploads .exe and .msi to pre-release assets
  • Install MSI on a Windows VM: msiexec /i bartoc-VERSION-x86_64.msi SERVICEACCOUNT=".\bartoc_svc" SERVICEPASSWORD="..." /l*v install.log
  • Verify service is registered in SCM and starts: sc query bartoc shows RUNNING
  • Set secrets as service account user: barto-cli secrets set BARTOC_HMAC_KEY etc.; confirm tracing log shows credentials loaded from Credential Manager
  • sc stop bartoc — verify clean shutdown; sc delete bartoc; verify uninstall removes all files
  • Console mode: bartoc.exe --config-absolute-path ... (no --service) works as before

PowerShell scripts

  • scripts\run_all.ps1 -? — verify help output
  • scripts\run_musl.ps1 -? — verify help output
  • scripts\run_all.ps1 -NoTest -NoCoverage -NoDocs -NoInstall -NoMusl — runs fmt + clippy + build only

🤖 Generated with Claude Code

@CraZySacX CraZySacX self-assigned this May 31, 2026
@CraZySacX CraZySacX added the CI/CD Changes for CI/CD label May 31, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.73%. Comparing base (efc8638) to head (2fdcc35).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #216   +/-   ##
=======================================
  Coverage   97.73%   97.73%           
=======================================
  Files          31       31           
  Lines        4804     4804           
=======================================
  Hits         4695     4695           
  Misses        109      109           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

CraZySacX and others added 4 commits May 31, 2026 00:57
Add options=(!strip !debug) to bartoc-bin, bartos-bin, and barto-cli-bin
PKGBUILDs. The pre-compiled musl static binaries have no DWARF debug
symbols, causing makepkg's default debug option to emit spurious
gdb-add-index errors on every install/upgrade.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rewrite the upgrade block in bartoc-post-install.sh to match the correct
logic already used in the AUR bartoc.install post_upgrade():

- Move daemon-reload outside the service loop (was called once per
  service per user instead of once per user)
- Use XOR logic for bartoc vs bartoc-age (was looping both independently)
- Replace `restart ... || true` + unconditional success message with an
  if/else that surfaces failures as a warning without failing the package
  install — previously a failed restart was silently swallowed and
  "restarted successfully" printed regardless
- Handle bartoc-logrotate.timer separately after the main service, with
  the same if/else error reporting
- Add fallback message when neither service is enabled for a user

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a native aarch64-apple-darwin build job for bartoc and barto-cli,
Homebrew formula templates with version/SHA placeholders, and an
update-homebrew CI job that computes checksums and pushes generated
formulas to the rustyhorde/homebrew-barto tap. Pre-release and release
jobs now collect and publish macOS tarballs alongside Linux assets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CraZySacX CraZySacX force-pushed the 199-post-141-mainetenance branch from eb1ddd7 to 990748a Compare May 31, 2026 04:57
CraZySacX and others added 2 commits May 31, 2026 10:11
bartoc can now run as a Windows Service via a new --service flag that
activates SCM dispatch mode (without it, console behavior is unchanged
on all platforms).

- bartoc/src/service.rs: new Windows-only module; SCM dispatcher using
  the windows-service crate, status reporting, and clean stop via a
  CancellationToken passed to run()
- bartoc/src/main.rs: remove #[tokio::main]; check raw argv for
  --service before building the tokio runtime; fall through to explicit
  block_on for console mode
- bartoc/src/runtime/mod.rs: run() gains service_token parameter so SCM
  Stop cancels the retry loop and per-connection tokens; add
  load_windows_credentials() to read BARTOC_HMAC_KEY and friends from
  Windows Credential Manager at startup (mirrors bartoc-launcher.ps1)
- bartoc/src/db/mod.rs: create_dir_all on the redb parent so
  %ProgramData%\bartoc\ is created on first run
- bartoc/wix/main.wxs: WiX 3.x installer — binary to %ProgramFiles%,
  delayed-auto-start service, restart-on-failure, example config and PS1
  launcher to %ProgramData%\bartoc\
- packaging/wix/README.Windows.md: setup guide covering MSI install,
  dedicated service account, secret management, and manual sc create
- xtask/src/main.rs: include bartoc-launcher.ps1 in dist tarball
- .github/workflows/release.yml: build-windows job (MSVC, cargo-wix);
  pre-release and release jobs now include Windows artifacts
- .github/workflows/barto.yml: clippy-windows target → msvc (required
  for windows-service linker)
- Workspace deps: keyring-core 1.0.0, windows-native-keyring-store
  1.1.0, windows-service 0.8.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CraZySacX CraZySacX changed the title feat(packaging): add macOS release builds and Homebrew tap support feat(packaging): add macOS release builds, Homebrew tap support, and Windows service/MSI May 31, 2026
CraZySacX and others added 8 commits May 31, 2026 12:14
… scripts

- Wrap std::env::set_var in unsafe block (now required by Rust 2024); add
  #[allow(unsafe_code)] to load_windows_credentials
- Move const items before the match statement to satisfy items_after_statements
- Gate allow(non_exhaustive_omitted_patterns) on all(feature = "unstable", nightly)
  to match the condition under which the lint is denied, since ServiceControl
  is #[non_exhaustive] from an external crate
- Add scripts/run_all.ps1, run_install.ps1, and run_musl.ps1 as Windows
  equivalents of the existing fish scripts (run_musl.ps1 adapted for
  Windows Docker Desktop: drops sudo chown, uses USERPROFILE paths)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace --bin-path (WiX toolset compiler path) with --target
x86_64-pc-windows-msvc so cargo-wix locates the pre-built binary
at the correct cross-target output directory.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WiX candle (v3) rejects XML comments containing '--', causing the
Generate MSI CI job to fail with exit code 104.  Rephrase the comment
to avoid '--service'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main.wxs uses <util:ServiceConfig> for delayed auto-start and failure
recovery, which requires WixUtilExtension.dll. Without -ext, candle
exits with code 4 (one error per unrecognised util namespace element).

Passes -e WixUtilExtension via the CI cargo-wix invocation and anchors
the same requirement in [package.metadata.wix] for local builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous attempt to fix the candle exit-4 failure by passing
-e WixUtilExtension was incorrect — cargo-wix includes WixUtilExtension
by default. Reverts that change and adds --nocapture so the actual
candle error messages appear in CI logs for proper diagnosis.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD Changes for CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants