This document compares the current single-runner approach with the new matrix strategy approach for building separate architecture binaries.
runs-on: macos-latest # GitHub ARM64 runner
cmake -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" ..
make[GitHub ARM64 Runner] -> [Universal Binary]
|
+-> Build both arm64 + x86_64
+-> Output: Universal binary
strategy:
matrix:
arch: [arm64, x86_64]
include:
- arch: arm64
runs-on: macos-latest # GitHub ARM64 runner
- arch: x86_64
runs-on: [self-hosted, macos-intel] # Your Intel Mac
# Each job builds for its specific architecture
cmake -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} ..[GitHub ARM64 Runner] -> [ARM64 Binary] -> [ARM64 DMG]
[Intel Mac Self-hosted] -> [x86_64 Binary] -> [x86_64 DMG]
| Aspect | Current (Single Runner) | New (Matrix Strategy) |
|---|---|---|
| Build Time | ✅ Faster (parallel native builds) | |
| GitHub Actions Cost | 💰 Higher (all minutes on GitHub) | 💰 Lower (x86_64 on your hardware) |
| Debugging | ❌ Hard to isolate arch issues | ✅ Easy per-architecture debugging |
| Reliability | ✅ Native compilation reliability | |
| Setup Complexity | ✅ Simple (single runner) | ❌ Complex (self-hosted setup) |
| Resource Usage | ❌ GitHub runner does everything | ✅ Distributed across machines |
| Architecture Separation | ❌ Same config for both | ✅ Different configs possible |
| Distribution | ❌ Universal binary (larger) | ✅ Separate binaries (smaller each) |
| User Choice | ❌ One size fits all | ✅ Users download their architecture |
| Testing | ❌ Can't test individual archs | ✅ Can test each arch separately |
| Maintenance | ✅ Zero maintenance | ❌ Runner maintenance required |
GitHub Runner (ARM64):
├── Configure CMake (universal): ~2 min
├── Build ARM64 + x86_64: ~15 min
├── Package: ~3 min
└── Total: ~20 min
Parallel Jobs:
├── GitHub Runner (ARM64):
│ ├── Configure: ~1 min
│ ├── Build ARM64: ~7 min
│ ├── Package ARM64 DMG: ~2 min
│ └── Subtotal: ~10 min
│
├── Intel Mac (x86_64):
│ ├── Configure: ~1 min
│ ├── Build x86_64: ~7 min
│ ├── Package x86_64 DMG: ~2 min
│ └── Subtotal: ~10 min
Total: ~10 min (fully parallel)
Result: ~50% faster builds 🚀
- "bad CPU type in executable" errors
- Cross-compilation Qt framework issues
- Architecture-specific dependency problems
- Hard to debug which architecture causes issues
- Each architecture builds natively (more reliable)
- Easy to isolate problems to specific architecture
- Independent dependency resolution
- Better error messages and debugging
Current Approach:
20 minutes × macOS multiplier (10x) = 200 GitHub minutes per build
New Approach:
GitHub Runner: 10 minutes × 10x = 100 minutes
Intel Mac: 10 minutes × 0x = 0 minutes (your hardware)
Total: 100 GitHub minutes per build
Savings: 50% reduction in GitHub Actions costs 💰
- Set up Intel Mac as self-hosted runner
- Test the new workflow on a branch
- Verify universal binaries work correctly
- Run both workflows in parallel
- Compare build times and reliability
- Gather feedback and metrics
- Make dual-runner the default for releases
- Keep single-runner as backup
- Monitor for any issues
- Fine-tune runner performance
- Add architecture-specific optimizations
- Implement dependency caching
- Self-hosted runner maintenance: Need to keep Intel Mac online and updated
- Network dependency: Intel Mac needs stable internet
- Single point of failure: If Intel Mac is down, no x86_64 builds
- Security: Self-hosted runner has repository access
- Backup runner: Set up secondary Intel Mac
- Monitoring: Add runner health checks
- Fallback: Keep single-runner workflow as backup
- Security: Use dedicated runner user account
Recommended approach: Matrix Strategy with Separate Binaries
- Better reliability: Native builds are more reliable than cross-compilation
- Cost savings: 50% reduction in GitHub Actions minutes
- Performance: 50% faster build times
- Debugging: Much easier to troubleshoot architecture-specific issues
- User choice: Smaller downloads, users pick their architecture
- Future-proofing: Better foundation for additional architectures
- Follow
SELF_HOSTED_RUNNER_SETUP.mdto set up your Intel Mac - Test using the new workflow
.github/workflows/macos-matrix-build.yml - Compare results with current approach
- Switch over once confident in the new system
- Build success rate: Should improve with native builds
- Build time: Target 50% improvement
- GitHub Actions cost: Target 50% reduction
- Issue resolution time: Should be faster with better debugging
- ✅ Architecture-specific binaries pass all tests
- ✅ Build times under 12 minutes
- ✅ 95%+ build success rate
- ✅ Zero architecture-related issues for 2 weeks
This matrix strategy approach gives you clean, separate architecture binaries with much better performance! 🎯