Quick start
Create a.gitlab-ci.yml file in your repository root:
.gitlab-ci.yml
Platform-specific configurations
- Android
- iOS
Complete pipeline example
Here’s a production-ready pipeline with multiple stages:.gitlab-ci.yml
Using GitLab CI/CD variables
Store sensitive data as CI/CD variables:Add variables
Add the following variables:
EW_API_TOKEN- emulator.wtf API tokenGCLOUD_SERVICE_KEY- Google Cloud service account JSONGCP_PROJECT_ID- Google Cloud project ID
Parallel testing
Run tests across multiple configurations in parallel:Optimization strategies
Caching
Conditional pipeline execution
Run tests only when specific files change:Using Docker cache
Artifact management
Collect test artifacts for debugging:Merge request integration
Show test results in merge requests:Troubleshooting
Flutter SDK not found
Flutter SDK not found
Use a Docker image with Flutter pre-installed:Or install Flutter in
before_script:Android SDK licenses not accepted
Android SDK licenses not accepted
Accept licenses in your pipeline:
macOS runner not available
macOS runner not available
GitLab.com doesn’t provide macOS runners by default. You need to:
- Register your own macOS runner
- Tag it with
macos - Reference it in your jobs using
tags: [macos]
Cache not working
Cache not working
Ensure cache paths are relative to project directory:Clear cache if needed: CI/CD > Pipelines > Clear runner caches
Best practices
Use Docker images
Use pre-built Flutter Docker images to speed up pipeline execution.
Cache dependencies
Cache pub packages, Gradle dependencies, and CocoaPods to reduce build times.
Parallelize tests
Use GitLab’s parallel matrix feature to test multiple configurations simultaneously.
Optimize artifact storage
Set appropriate expiration times for artifacts to save storage costs.
Next steps
Firebase Test Lab
Integrate Firebase Test Lab with GitLab CI
CI/CD Overview
Back to CI/CD overview