From 394c396d899ba22b428dd70dba65670ba3817b68 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Tue, 30 Jul 2024 20:33:16 -0400 Subject: [PATCH] iOS/tvOS: Add fastlane for TestFlight automation (#16824) * iOS: Add fastlane for TestFlight automation * tvOS: Add fastlane for TestFlight automation --- pkg/apple/.gitignore | 2 + pkg/apple/Gemfile | 3 + pkg/apple/Gemfile.lock | 220 ++++++++++++++++++ .../RetroArch_iOS13.xcodeproj/project.pbxproj | 6 +- pkg/apple/fastlane/Appfile | 8 + pkg/apple/fastlane/Fastfile | 134 +++++++++++ pkg/apple/fastlane/README.md | 45 ++++ pkg/apple/iOS/AppStore.xcconfig | 10 +- pkg/apple/tvOS/Info.plist | 1 - pkg/apple/tvOS/RetroArchTopShelf.entitlements | 10 + 10 files changed, 428 insertions(+), 11 deletions(-) create mode 100644 pkg/apple/Gemfile create mode 100644 pkg/apple/Gemfile.lock create mode 100644 pkg/apple/fastlane/Appfile create mode 100644 pkg/apple/fastlane/Fastfile create mode 100644 pkg/apple/fastlane/README.md create mode 100644 pkg/apple/tvOS/RetroArchTopShelf.entitlements diff --git a/pkg/apple/.gitignore b/pkg/apple/.gitignore index cbf700b9d69..3224d3edbc4 100644 --- a/pkg/apple/.gitignore +++ b/pkg/apple/.gitignore @@ -4,3 +4,5 @@ iOS/filters/ iOS/Frameworks/ tvOS/filters/ tvOS/Frameworks/ +fastlane/report.xml +RetroArch.ipa diff --git a/pkg/apple/Gemfile b/pkg/apple/Gemfile new file mode 100644 index 00000000000..7a118b49be7 --- /dev/null +++ b/pkg/apple/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/pkg/apple/Gemfile.lock b/pkg/apple/Gemfile.lock new file mode 100644 index 00000000000..44076fd06a5 --- /dev/null +++ b/pkg/apple/Gemfile.lock @@ -0,0 +1,220 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + artifactory (3.0.17) + atomos (0.1.3) + aws-eventstream (1.3.0) + aws-partitions (1.957.0) + aws-sdk-core (3.201.2) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.8) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.88.0) + aws-sdk-core (~> 3, >= 3.201.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.156.0) + aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.8.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.2.0) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.5) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.6.20240107) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.111.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.3.1) + fastlane (2.221.1) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored (~> 1.2) + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + http-cookie (~> 1.0.5) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (>= 2.0.0, < 3.0.0) + naturally (~> 2.2) + optparse (>= 0.1.1, < 1.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.5) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (~> 3) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.31.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.7.0) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.4.0) + google-cloud-storage (1.47.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.6) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.6.2) + json (2.7.2) + jwt (2.8.2) + base64 + mini_magick (4.13.2) + mini_mime (1.1.5) + multi_json (1.15.0) + multipart-post (2.4.1) + nanaimo (0.3.0) + naturally (2.2.1) + nkf (0.2.0) + optparse (0.5.0) + os (1.1.4) + plist (3.7.1) + public_suffix (6.0.1) + rake (13.2.1) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.9) + strscan + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.5) + signet (0.19.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + strscan (3.1.0) + terminal-notifier (2.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unicode-display_width (2.5.0) + word_wrap (1.0.0) + xcodeproj (1.24.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.5.14 diff --git a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj index c70132bf9a6..01e4ea7b9bd 100644 --- a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj @@ -1712,7 +1712,7 @@ buildSettings = { ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_ENTITLEMENTS = "$(TVOS_CODE_SIGN_ENTITLEMENTS)"; + CODE_SIGN_ENTITLEMENTS = "$(TVOS_TOPSHELF_CODE_SIGN_ENTITLEMENTS)"; GCC_C_LANGUAGE_STANDARD = gnu17; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = RetroArchTopShelfExtension/Info.plist; @@ -1740,7 +1740,7 @@ buildSettings = { ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_ENTITLEMENTS = "$(TVOS_CODE_SIGN_ENTITLEMENTS)"; + CODE_SIGN_ENTITLEMENTS = "$(TVOS_TOPSHELF_CODE_SIGN_ENTITLEMENTS)"; GCC_C_LANGUAGE_STANDARD = gnu17; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = RetroArchTopShelfExtension/Info.plist; @@ -1809,6 +1809,7 @@ ../../gfx/include, ); INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = "$(RA_IPHONEOS_DEPLOYMENT_TARGET:default=13.0)"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1858,6 +1859,7 @@ ../../gfx/include, ); INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = "$(RA_IPHONEOS_DEPLOYMENT_TARGET:default=13.0)"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/pkg/apple/fastlane/Appfile b/pkg/apple/fastlane/Appfile new file mode 100644 index 00000000000..99ed7c59c5f --- /dev/null +++ b/pkg/apple/fastlane/Appfile @@ -0,0 +1,8 @@ +app_identifier("com.libretro.dist.RetroArch") # The bundle identifier of your app +apple_id("libretro@gmail.com") # Your Apple Developer Portal username + +itc_team_id("118576492") # App Store Connect Team ID +team_id("UK699V5ZS8") # Developer Portal Team ID + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/pkg/apple/fastlane/Fastfile b/pkg/apple/fastlane/Fastfile new file mode 100644 index 00000000000..a212166b421 --- /dev/null +++ b/pkg/apple/fastlane/Fastfile @@ -0,0 +1,134 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + desc "Push a new beta build to TestFlight" + lane :beta do + # this needs these environment variables set: + # APP_STORE_CONNECT_API_KEY_KEY_ID, + # APP_STORE_CONNECT_API_KEY_ISSUER_ID, + # APP_STORE_CONNECT_API_KEY_KEY_FILEPATH + app_store_connect_api_key + + reset_git_repo( + force: true, + files: [ + "./assets.zip", + "./iOS/Info.plist" + ] + ) + ensure_git_status_clean + git_pull + app_store_build_number( + app_identifier: "com.libretro.dist.RetroArch", + platform: "ios", + username: "libretro@gmail.com", + team_id: "118576492", + live: true + ) + latest_testflight_build_number( + app_identifier: "com.libretro.dist.RetroArch", + platform: "ios", + username: "libretro@gmail.com", + team_id: "118576492" + ) + next_version_number = lane_context[SharedValues::LATEST_TESTFLIGHT_VERSION] + if lane_context[SharedValues::LATEST_VERSION] == lane_context[SharedValues::LATEST_TESTFLIGHT_VERSION] + version_array = next_version_number.split(".").map(&:to_i) + version_array[-1] = version_array[-1] + 1 + next_version_number = version_array.join(".") + end + # can't use update_build_number/agvtool to update this as it + # doesn't deal with multiple projects in the same folder + update_info_plist( + plist_path: "iOS/Info.plist", + block: proc do |plist| + plist["CFBundleVersion"] = (lane_context[SharedValues::LATEST_TESTFLIGHT_BUILD_NUMBER] + 1).to_s + plist["CFBundleShortVersionString"] = next_version_number + end + ) + build_app( + workspace: "RetroArch.xcworkspace", + scheme: "RetroArch iOS Release", + xcconfig: "iOS/AppStore.xcconfig" + ) + upload_to_testflight( + distribute_external: true, + groups: "Invaders, Patreons", + changelog: "Rebuild frontend from latest master branch and take latest build of all cores." + ) + end +end + +platform :appletvos do + desc "Push a new beta build to TestFlight" + lane :beta do + # this needs these environment variables set: + # APP_STORE_CONNECT_API_KEY_KEY_ID, + # APP_STORE_CONNECT_API_KEY_ISSUER_ID, + # APP_STORE_CONNECT_API_KEY_KEY_FILEPATH + app_store_connect_api_key + + reset_git_repo( + force: true, + files: [ + "./assets.zip", + "./tvOS/Info.plist" + ] + ) + ensure_git_status_clean + git_pull + app_store_build_number( + app_identifier: "com.libretro.dist.RetroArch", + platform: "appletvos", + username: "libretro@gmail.com", + team_id: "118576492", + live: true + ) + latest_testflight_build_number( + app_identifier: "com.libretro.dist.RetroArch", + platform: "appletvos", + username: "libretro@gmail.com", + team_id: "118576492" + ) + next_version_number = lane_context[SharedValues::LATEST_TESTFLIGHT_VERSION] + if lane_context[SharedValues::LATEST_VERSION] == lane_context[SharedValues::LATEST_TESTFLIGHT_VERSION] + version_array = next_version_number.split(".").map(&:to_i) + version_array[-1] = version_array[-1] + 1 + next_version_number = version_array.join(".") + end + # can't use update_build_number/agvtool to update this as it + # doesn't deal with multiple projects in the same folder + update_info_plist( + plist_path: "tvOS/Info.plist", + block: proc do |plist| + plist["CFBundleVersion"] = (lane_context[SharedValues::LATEST_TESTFLIGHT_BUILD_NUMBER] + 1).to_s + plist["CFBundleShortVersionString"] = next_version_number + end + ) + build_app( + workspace: "RetroArch.xcworkspace", + scheme: "RetroArch tvOS Release", + xcconfig: "iOS/AppStore.xcconfig" + ) + upload_to_testflight( + distribute_external: true, + groups: "Invaders, Patreons", + changelog: "Rebuild frontend from latest master branch and take latest build of all cores." + ) + end +end diff --git a/pkg/apple/fastlane/README.md b/pkg/apple/fastlane/README.md new file mode 100644 index 00000000000..daba7c1f26b --- /dev/null +++ b/pkg/apple/fastlane/README.md @@ -0,0 +1,45 @@ +fastlane documentation +---- + +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +```sh +xcode-select --install +``` + +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) + +# Available Actions + +## iOS + +### ios beta + +```sh +[bundle exec] fastlane ios beta +``` + +Push a new beta build to TestFlight + +---- + + +## appletvos + +### appletvos beta + +```sh +[bundle exec] fastlane appletvos beta +``` + +Push a new beta build to TestFlight + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/pkg/apple/iOS/AppStore.xcconfig b/pkg/apple/iOS/AppStore.xcconfig index 968e4ca5f16..ef8f713f463 100644 --- a/pkg/apple/iOS/AppStore.xcconfig +++ b/pkg/apple/iOS/AppStore.xcconfig @@ -6,13 +6,6 @@ APPSTORE_BUILD = 1 -// the app store versioning tries to track closely to RetroArch's, however -// the app store version must be major.minor.patch and always incrementing, -// so any follow up/hotfix releases will necessarily have the patch version -// drift a little bit -MARKETING_VERSION = 1.18.3 -CURRENT_PROJECT_VERSION = 12 - OTHER_CFLAGS = $(inherited) -DHAVE_APPLE_STORE OTHER_CFLAGS = $(inherited) -DHAVE_ICLOUD OTHER_CFLAGS = $(inherited) -DkRetroArchAppGroup=@\"group.com.libretro.dist.RetroArchGroup\" @@ -22,6 +15,7 @@ TVOS_BUNDLE_IDENTIFIER = com.libretro.dist.RetroArch IOS_CODE_SIGN_ENTITLEMENTS = iOS/RetroArchiOS.entitlements TVOS_CODE_SIGN_ENTITLEMENTS = tvOS/RetroArchTV.entitlements +TVOS_TOPSHELF_CODE_SIGN_ENTITLEMENTS = tvOS/RetroArchTopShelf.entitlements -IPHONEOS_DEPLOYMENT_TARGET = 14.2 +RA_IPHONEOS_DEPLOYMENT_TARGET = 14.2 TVOS_DEPLOYMENT_TARGET = 14.2 diff --git a/pkg/apple/tvOS/Info.plist b/pkg/apple/tvOS/Info.plist index 68f6152922c..710996f691e 100644 --- a/pkg/apple/tvOS/Info.plist +++ b/pkg/apple/tvOS/Info.plist @@ -1669,7 +1669,6 @@ - UTTypeConformsTo diff --git a/pkg/apple/tvOS/RetroArchTopShelf.entitlements b/pkg/apple/tvOS/RetroArchTopShelf.entitlements new file mode 100644 index 00000000000..689030bc567 --- /dev/null +++ b/pkg/apple/tvOS/RetroArchTopShelf.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.com.libretro.dist.RetroArchGroup + + +