Skip to content

Instantly share code, notes, and snippets.

@glennmartinez
Created January 1, 2025 08:28
Show Gist options
  • Select an option

  • Save glennmartinez/7f26bc6a3b35f2c83d1d85bffe3d7c5f to your computer and use it in GitHub Desktop.

Select an option

Save glennmartinez/7f26bc6a3b35f2c83d1d85bffe3d7c5f to your computer and use it in GitHub Desktop.
Panchito's Flutterino Buildino
name: Flutter Integration Tests
on:
push:
branches:
- main
pull_request:
branches:
- main # or your target branch for pull requests
jobs:
test:
runs-on: macOS-latest
env:
CI: true
steps:
- uses: actions/checkout@v4
- name: Cache Flutter and Pods
uses: actions/cache@v3
with:
path: |
~/flutter
~/.pub-cache
ios/Pods
~/.cocoapods
key: ${{ runner.os }}-cache-${{ hashFiles('**/pubspec.yaml', 'ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cache-
- uses: futureware-tech/simulator-action@v3
with:
model: "iPhone 15"
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Install dependencies
run: |
flutter pub get
- name: Setup test env
run: |
echo "STORE_TYPE=SERVER" > .env
- name: Run tests
env:
CI: true
SKIP_POD_INSTALL: true # This might not work for all setups
run: |
flutter test integration_test \
--dart-define=CI=true
# flutter test integration_test --dart-define=CI=true --machine > tests.output
# cat tests.output | flutter pub run junitreport:tojunit --output build/test-results.xml
# Step 5: Capture test results
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: Test Results
path: build/test-results.xml
# Add this at the top of your Podfile
install! 'cocoapods', :deterministic_uuids => false
# Add this before your target definitions
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
# Keep these commented out since we're using the pre-compiled version
# pod 'Firebase/Core', :modular_headers => true
# pod 'Firebase/Firestore', :modular_headers => true
# pod 'FirebaseFirestore', :modular_headers => true
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '11.2.0'
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment