Skip to content

Commit

Permalink
Testflight (#1938)
Browse files Browse the repository at this point in the history
* Setup testflight against v8 branch

* enable run on pr

* run on push

* make executable

* fix beta version number

* push on main, release and workflow update

* bump xcode default version to 15.0.1

* add newline

* Add ITSAppUsesNonExemptEncryption to info.plist

* select with xcodes

* fix file extension

* fix warnings

* use correct property to remove warning

* Update ktlint

---------

Co-authored-by: GIancarlo Buenaflor <[email protected]>
  • Loading branch information
denrase and buenaflor authored Apr 10, 2024
1 parent 8166d0c commit 6075021
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ jobs:
- uses: actions/checkout@v4

- name: ktlint
uses: ScaCap/action-ktlint@0ff81efa49425bd0df46caabd8005aafdc8f2cf2 # [email protected].0
uses: ScaCap/action-ktlint@38262d0fb8bff43ddafc8b3c04bce6e6c7263319 # [email protected].1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Upload to Testflight
on:
push:
branches:
- main
- release/**
pull_request:
paths:
- '.github/workflows/testflight.yml'

jobs:
upload_to_testflight:
name: Build and Upload to Testflight
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
- run: xcodes select 15.0.1
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
with:
ruby-version: '2.7.5'
bundler-cache: true

- name: flutter
working-directory: ./flutter/example
run: |
flutter upgrade
flutter pub get
flutter build ios --no-codesign
- name: Install Fastlane
working-directory: ./flutter/example/ios
run: bundle install

- name: Bump, Build & Upload App to TestFlight
working-directory: ./flutter/example/ios
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_BUNDLE_VERSION: ${{ github.run_number }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_LOG_LEVEL: DEBUG
run: |
bundle exec fastlane bump_build_number
bundle exec fastlane build_release
bundle exec fastlane upload_testflight
- name: Upload Symbols to Sentry
working-directory: ./flutter/example
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: flutter packages pub run sentry_dart_plugin
2 changes: 1 addition & 1 deletion flutter/example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
3 changes: 3 additions & 0 deletions flutter/example/ios/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
2 changes: 1 addition & 1 deletion flutter/example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
21 changes: 12 additions & 9 deletions flutter/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -483,6 +483,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -491,7 +492,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand All @@ -518,7 +519,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = NO;
Expand Down Expand Up @@ -547,7 +548,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
Expand All @@ -574,7 +575,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -631,7 +632,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -681,7 +682,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -706,6 +707,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -714,7 +716,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -737,6 +739,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -745,7 +748,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
10 changes: 6 additions & 4 deletions flutter/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand All @@ -22,6 +26,8 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -41,9 +47,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
7 changes: 7 additions & 0 deletions flutter/example/ios/fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
app_identifier("io.sentry.flutter.sample") # The bundle identifier of your app

itc_team_id("96157806") # App Store Connect Team ID
team_id("97JCY7859U") # Developer Portal Team ID

# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
95 changes: 95 additions & 0 deletions flutter/example/ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
default_platform(:ios)

platform :ios do

desc "Bump Build Number"
lane :bump_build_number do
fetch_api_key()

version_string = get_version_number(xcodeproj: "./Runner.xcodeproj")
version_parts = version_string.split(".")

# Remove last digit if necessary
if version_parts.length > 3
version_parts.pop
end

new_version = version_parts.join(".")

increment_version_number(
version_number: new_version,
xcodeproj: "./Runner.xcodeproj"
)
increment_build_number(
build_number: latest_testflight_build_number + 1,
xcodeproj: "./Runner.xcodeproj"
)
end

desc "Build Release"
lane :build_release do

setup_ci

disable_automatic_code_signing

sync_code_signing(
type: "development",
readonly: true,
app_identifier: ["io.sentry.flutter.sample"]
)

sync_code_signing(
type: "appstore",
readonly: true,
app_identifier: ["io.sentry.flutter.sample"]
)

update_project_provisioning(
xcodeproj: "Runner.xcodeproj",
target_filter: "Runner",
profile: ENV["sigh_io.sentry.flutter.sample_appstore_profile-path"],
build_configuration: "Release"
)

build_app(
workspace: "Runner.xcworkspace",
scheme: "Runner",
configuration: "Release",
clean: true,
include_symbols: true,
export_method: "app-store",
output_directory:"./build/",
export_options: {
method: "app-store",
provisioningProfiles: {
"io.sentry.flutter.sample" => ENV["sigh_io.sentry.flutter.sample_appstore_profile-name"]
}
},
codesigning_identity: ENV["sigh_io.sentry.flutter.sample_appstore_certificate-name"],
output_name: "sentry_flutter_sample.ipa"
)

delete_keychain(
name: "fastlane_tmp_keychain"
) unless is_ci
end

desc "Upload to TestFlight"
lane :upload_testflight do
fetch_api_key()
testflight(
skip_waiting_for_build_processing: true,
ipa: "./build/sentry_flutter_sample.ipa"
)
end

desc "Fetch ASC API Key"
lane :fetch_api_key do
app_store_connect_api_key(
key_id: ENV["APP_STORE_CONNECT_KEY_ID"],
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
key_content: ENV["APP_STORE_CONNECT_KEY"]
)
end
end
5 changes: 5 additions & 0 deletions flutter/example/ios/fastlane/Matchfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
git_url("[email protected]:getsentry/codesigning.git")
storage_mode("git")
username("[email protected]") # Your Apple Developer Portal username

# The docs are available on https://docs.fastlane.tools/actions/match
28 changes: 4 additions & 24 deletions flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,7 @@ class MainScaffold extends StatelessWidget {
TooltipButton(
onPressed: () async {
final id = await Sentry.captureMessage('UserFeedback');
// ignore: use_build_context_synchronously
if (!context.isMounted) {
return;
}

// ignore: use_build_context_synchronously
if (!context.mounted) return;
await showDialog(
context: context,
builder: (context) {
Expand Down Expand Up @@ -906,12 +901,7 @@ Future<void> makeWebRequest(BuildContext context) async {

await transaction.finish(status: const SpanStatus.ok());

// ignore: use_build_context_synchronously
if (!context.isMounted) {
return;
}

// ignore: use_build_context_synchronously
if (!context.mounted) return;
await showDialog<void>(
context: context,
builder: (context) {
Expand Down Expand Up @@ -957,12 +947,7 @@ Future<void> makeWebRequestWithDio(BuildContext context) async {
await span.finish();
}

// ignore: use_build_context_synchronously
if (!context.isMounted) {
return;
}

// ignore: use_build_context_synchronously
if (!context.mounted) return;
await showDialog<void>(
context: context,
builder: (context) {
Expand Down Expand Up @@ -992,12 +977,7 @@ Future<void> showDialogWithTextAndImage(BuildContext context) async {
final text =
await DefaultAssetBundle.of(context).loadString('assets/lorem-ipsum.txt');

// ignore: use_build_context_synchronously
if (!context.isMounted) {
return;
}

// ignore: use_build_context_synchronously
if (!context.mounted) return;
await showDialog<void>(
context: context,
// gets tracked if using SentryNavigatorObserver
Expand Down

0 comments on commit 6075021

Please sign in to comment.