3. Teori: Arsitektur Xcode Cloud
3. Teori: Arsitektur Xcode Cloud
Komponen Utama
1. Workflow — blueprint yang mendefinisikan kapan build dimulai, apa yang dikerjakan, dan apa yang dilakukan setelah selesai. Satu project bisa memiliki beberapa workflow.
2. Build — satu eksekusi dari workflow. Setiap build punya log, artifact, dan test result.
3. Actions — langkah-langkah dalam workflow:
- Build — compile source code
- Test — jalankan unit test dan UI test di simulator
- Analyze — static analysis (Clang Analyzer)
- Archive — buat .ipa untuk distribusi
4. Post-Actions — setelah semua action selesai:
- Notify — kirim notifikasi ke Slack/email
- TestFlight Internal Testing — distribusi ke internal tester
- TestFlight External Testing — distribusi ke external beta tester
- App Store — release ke production
Build Environment
Xcode Cloud menjalankan setiap build di environment terisolasi yang fresh:
Build Environment:
├── macOS versi terbaru (otomatis diupdate Apple)
├── Xcode versi yang dipilih di workflow
├── Swift toolchain sesuai Xcode
├── Simulator runtimes (iOS, watchOS, tvOS, visionOS)
├── Node.js, Python, Ruby (tersedia untuk custom scripts)
└── Homebrew (tersedia tapi lambat — minimize penggunaan)
Source Code Integration
Xcode Cloud terhubung ke repository melalui OAuth:
- GitHub (github.com dan GitHub Enterprise)
- GitLab (gitlab.com dan self-hosted)
- Bitbucket (bitbucket.org dan Bitbucket Server)
Setelah terhubung, Xcode Cloud mendapatkan akses baca ke repository dan mendaftarkan webhook untuk menerima notifikasi push.
ci_scripts Directory
Titik ekstensi utama Xcode Cloud adalah folder khusus di root project:
MyApp/
├── MyApp.xcodeproj
├── MyApp/
│ └── ...
└── ci_scripts/ ← direktori khusus Xcode Cloud
├── ci_post_clone.sh ← dijalankan setelah clone
├── ci_pre_xcodebuild.sh ← sebelum build/test/analyze/archive
└── ci_post_xcodebuild.sh ← setelah build/test/analyze/archive
Script ini adalah shell script biasa (bash/zsh) yang berjalan di build environment. Jika script return non-zero exit code, build dianggap gagal.