Skip to content

Commit

Permalink
[1.72.*] Pre-release merge (#317)
Browse files Browse the repository at this point in the history
* Set BugSnag API key env variable in Android prod release workflow

* Apply BugSnag Gradle plugin to Android app module

* Add cocoapods-bugsnag plugin to automatically upload dSYM

* Remove upload dSYM step from iOS prod release workflow

* [Drop after testing] Throw exceptions to test Bugsnag implementation

---------

Co-authored-by: Sasikanth Miriyampalli <[email protected]>
  • Loading branch information
tramline-github[bot] and msasikanth authored Feb 14, 2024
1 parent 985679a commit 5427784
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/ios_prod_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
- name: Pod Install
run: |
gem install cocoapods-bugsnag;
./gradlew --no-daemon podInstall;
- name: Build Archive
Expand All @@ -90,13 +91,6 @@ jobs:
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/twine.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build
- name: Upload debug symbols to Bugsnag
run: |
cd $RUNNER_TEMP/twine.xcarchive/dSYMs/;
curl --http1.1 https://upload.bugsnag.com/ \
-F apiKey=${BUGSNAG_API_KEY} \
-F [email protected]/Contents/Resources/DWARF/Twine \
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
Expand Down
5 changes: 5 additions & 0 deletions iosApp/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
target 'iosApp' do
use_frameworks!
platform :ios, '15.0'

pod 'Bugsnag'
plugin 'cocoapods-bugsnag'

pod 'shared', :path => '../shared'

end
23 changes: 23 additions & 0 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
F85CB1118929364A9C6EFABC /* Frameworks */,
2134C13603D0B299603D9F49 /* [CP] Copy Pods Resources */,
599E3F199C42E8E830BDD65E /* [CP] Embed Pods Frameworks */,
E8479EF0239AA3C1B90F902B /* Upload Bugsnag dSYM */,
);
buildRules = (
);
Expand Down Expand Up @@ -236,6 +237,28 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
E8479EF0239AA3C1B90F902B /* Upload Bugsnag dSYM */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}",
"${BUILT_PRODUCTS_DIR}/Bugsnag/Bugsnag.framework.dSYM/Contents/Resources/DWARF/Bugsnag",
);
name = "Upload Bugsnag dSYM";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/usr/bin/env ruby";
shellScript = "# Set DISABLE_COCOAPODS_BUGSNAG=YES via Xcode's Build Settings, xcconfig or xcodebuild to skip upload\nif ENV['DISABLE_COCOAPODS_BUGSNAG'] == 'YES'\n puts 'Skipping dSYM upload'\n return\nend\n\n# Attempt to get the API key from an environment variable (or Xcode build setting)\napi_key = ENV[\"BUGSNAG_API_KEY\"]\n\n# If not present, attempt to lookup the value from the Info.plist\nunless api_key\n info_plist_path = \"#{ENV[\"BUILT_PRODUCTS_DIR\"]}/#{ENV[\"INFOPLIST_PATH\"]}\"\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :bugsnag:apiKey\" \"#{info_plist_path}\"`\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :BugsnagAPIKey\" \"#{info_plist_path}\"` if !$?.success?\n api_key = plist_buddy_response if $?.success?\nend\n\nfail(\"No Bugsnag API key detected - add your key to your Info.plist or BUGSNAG_API_KEY environment variable\") unless api_key\n\nif ENV['ENABLE_USER_SCRIPT_SANDBOXING'] == 'YES'\n count = ENV['SCRIPT_INPUT_FILE_COUNT'].to_i\n abort 'error: dSYMs must be specified as build phase \"Input Files\" because ENABLE_USER_SCRIPT_SANDBOXING is enabled' unless count > 0\n dsyms = []\n for i in 0 .. count - 1\n file = ENV[\"SCRIPT_INPUT_FILE_#{i}\"]\n next if file.end_with? '.plist'\n if File.exist? file\n dsyms.append file\n else\n abort \"error: cannot read #{file}\" unless ENV['DEBUG_INFORMATION_FORMAT'] != 'dwarf-with-dsym'\n end\n end\nelse\n dsyms = Dir[\"#{ENV['DWARF_DSYM_FOLDER_PATH']}/*/Contents/Resources/DWARF/*\"]\nend\n\ndsyms.each do |dsym|\n Process.detach Process.spawn('/usr/bin/curl', '--http1.1',\n '-F', \"apiKey=#{api_key}\",\n '-F', \"dsym=@#{dsym}\",\n '-F', \"projectRoot=#{ENV['PROJECT_DIR']}\",\n 'https://upload.bugsnag.com/',\n %i[err out] => :close\n )\nend\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
1 change: 0 additions & 1 deletion shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ kotlin {
homepage = "https://github.com/msasikanth/rss_reader"
ios.deploymentTarget = "15.0"
podfile = project.file("../iosApp/Podfile")
pod("Bugsnag")

framework {
baseName = "shared"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private fun OverflowMenu(onSettingsClicked: () -> Unit) {
onClick = {
dropdownExpanded = false
onSettingsClicked()
BugsnagKotlin.sendFatalException(Exception("Fatal exception from common code"))
throw Exception("Fatal exception from the common code")
}
)
}
Expand Down

0 comments on commit 5427784

Please sign in to comment.