Overview
Continuous Integration (CI) and Continuous Deployment (CD) are essential for maintaining code quality and automating releases. This guide covers setting up CI/CD pipelines optimized for Tuist projects.Understanding CI/CD with Tuist
Tuist projects have specific requirements in CI:- Deterministic project generation:
tuist generateproduces consistent projects - Dependency resolution:
tuist installmust run before generation - Binary caching: Significantly speeds up CI builds
- Selective testing: Reduces test execution time
GitHub Actions
GitHub Actions is a popular choice for iOS CI/CD.Basic Build Workflow
.github/workflows/build.yml
Optimized Workflow with Caching
.github/workflows/optimized-build.yml
Cache Warming Workflow
Warm the cache on the main branch to speed up PR builds:.github/workflows/cache-warm.yml
Release Workflow
.github/workflows/release.yml
GitLab CI
Basic Pipeline
.gitlab-ci.yml
Bitrise
bitrise.yml Configuration
bitrise.yml
CircleCI
config.yml
.circleci/config.yml
Best Practices
Use Force Resolved Versions
Always use--force-resolved-versions on CI:
Package.resolved.
Cache Dependencies Effectively
Cache both dependencies and Tuist’s cache:Enable Caching for Team Members Only
Prevent forks from accessing your cache:Set Appropriate Timeouts
Prevent jobs from hanging:Use Selective Testing
Run only affected tests:Warm Cache on Main Branch
Ensure PR builds have warm cache:Use Static Linking for Release Builds
Optimize release builds:Troubleshooting
Build Fails with “No such file or directory”
Cause: Project not generated before building Solution: Ensuretuist generate runs before xcodebuild:
Dependencies Not Found
Cause: Dependencies not installed Solution: Runtuist install before generation:
Cache Not Working
Cause: Authentication failure or caching disabled Solutions:-
Verify authentication:
-
Enable caching in Tuist.swift:
-
Check environment variable:
Slow Dependency Resolution
Cause: Not using resolved versions Solution: Always use--force-resolved-versions:
Tests Timing Out
Cause: Running full test suite Solution: Use selective testing:Code Signing Failures
Cause: Missing certificates or provisioning profiles Solutions:- Use Fastlane Match for certificate management
- Store certificates in CI secrets
- Import certificates before building:
Continuous Deployment
App Store Deployment with Fastlane
Fastfile
TestFlight Deployment
Fastfile
Monitoring CI Performance
Track Build Times
Add timing to your CI:Set Performance Goals
- PR builds: < 10 minutes
- Main branch builds: < 15 minutes
- Release builds: < 30 minutes
Next Steps
Build Optimization
Speed up CI builds with caching and optimization
Project Structure
Structure projects for efficient CI builds
Manage Dependencies
Optimize dependency management for CI
Migrate from Xcode
Migrate your project to unlock CI benefits