CI Integration
Set up FreezeRay in your CI pipeline to catch schema drift and migration failures before they reach production. This guide covers GitHub Actions, GitLab CI, and general CI/CD principles.Why CI Integration?
Problem: Developers can accidentally modify frozen schemas locally, commit changes, and push to main before running tests. Solution: CI automatically runs drift and migration tests on every push and pull request, blocking changes that would break production.What You’ll Need
- Frozen schemas with fixtures committed to git
- A test target with drift and migration tests
- CI/CD platform (GitHub Actions, GitLab CI, Bitrise, etc.)
- macOS CI runners (required for Xcode builds)
GitHub Actions Setup
Basic Configuration
Create.github/workflows/test.yml:
Targeted FreezeRay Tests
To run only FreezeRay tests (faster feedback):Use
-only-testing to run specific test classes for faster CI feedback.Parallel Jobs
Run drift and migration tests in parallel:Caching Dependencies
Speed up builds with caching:Matrix Testing
Test on multiple simulators:GitLab CI Setup
Create.gitlab-ci.yml:
Separate Drift and Migration Tests
Bitrise Setup
Createbitrise.yml:
- Scheme: MyApp
- Destination: platform=iOS Simulator,name=iPhone 15
CircleCI Setup
Create.circleci/config.yml:
Best Practices
1. Fail Fast on Drift
Run drift tests first (they’re faster than migration tests):2. Run on Every Pull Request
Catch drift before merging:3. Block Merging on Test Failures
GitHub: Enable “Require status checks to pass before merging” in branch protection rules. GitLab: Set pipeline to “must succeed” in merge request settings.4. Clear Error Messages
When tests fail, the error is logged in CI:5. Test Coverage Reports
Generate code coverage for migration tests:Common CI Issues
Issue 1: Simulator Not Found
Error:Issue 2: Fixtures Not Found
Error:-
Commit fixtures:
-
Verify fixtures are in git:
-
Ensure fixtures are in test bundle (Xcode projects):
- Select test target → Build Phases → Copy Bundle Resources
- Add
FreezeRay/folder
Issue 3: Build Takes Too Long
Problem: CI builds timeout (>10 minutes). Solutions:-
Cache dependencies:
-
Run only FreezeRay tests:
- Use faster macOS runners (GitHub: macos-latest, not macos-11)
Issue 4: Permission Denied Errors
Error:Issue 5: Test Flakiness
Problem: Tests sometimes pass, sometimes fail. Causes:- Race conditions in test setup
- Simulator state not reset between runs
- Network-dependent tests
-
Reset simulator state:
-
Increase test timeout:
-
Isolate test data:
Advanced Workflows
Pre-Merge Freeze Checks
Ensure no new schema versions are frozen without proper review:Slack Notifications on Failure
Notify team when drift is detected:Auto-Comment on PRs
Add a comment to PRs when drift is detected:Monitoring and Reporting
Track Schema Changes Over Time
Log schema versions in CI:Generate Migration Report
Create a summary of all migrations:Example: Full GitHub Actions Workflow
Here’s a complete, production-ready workflow:Summary
You’ve learned how to:- ✅ Set up FreezeRay tests in GitHub Actions, GitLab CI, and other CI platforms
- ✅ Run drift and migration tests in parallel
- ✅ Fail fast with drift detection
- ✅ Handle common CI issues
- ✅ Add notifications and reporting
Next Steps
First Freeze
Tutorial for freezing your first schema
Testing Migrations
Learn to write custom migration tests
Drift Detection
Understand how drift detection works
freeze command
CLI reference for freezing schemas