release.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. name: release
  2. permissions:
  3. contents: read
  4. on:
  5. pull_request:
  6. paths:
  7. - 'scripts/release_testing_setup.sh'
  8. - '.github/workflows/release.yml'
  9. - 'Gemfile*'
  10. workflow_dispatch:
  11. schedule:
  12. # Run every day at 10pm (PDT) / 1am (EDT) - cron uses UTC times
  13. - cron: '0 5 * * *'
  14. env:
  15. FIREBASE_CI: true
  16. concurrency:
  17. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  18. cancel-in-progress: true
  19. jobs:
  20. specs_checking:
  21. # Don't run on private repo unless it is a PR.
  22. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
  23. runs-on: macos-14
  24. env:
  25. botaccess: ${{ secrets.RELEASE_TESTING_PAT }}
  26. local_repo: specsreleasing
  27. podspec_repo_branch: main
  28. outputs:
  29. matrix: ${{ steps.generate_matrix.outputs.matrix }}
  30. steps:
  31. - name: Checkout code
  32. uses: actions/checkout@v4
  33. with:
  34. fetch-depth: 0
  35. - name: Generate matrix
  36. id: generate_matrix
  37. run: |
  38. cd "${GITHUB_WORKSPACE}/ReleaseTooling"
  39. swift run manifest --sdk-repo-url "${GITHUB_WORKSPACE}" --output-file-path ./output.json --for-gha-matrix-generation
  40. echo "::set-output name=matrix::{\"include\":$( cat output.json )}"
  41. - name: Update SpecsReleasing repo setup
  42. run: |
  43. podspec_repo_branch="${podspec_repo_branch}" \
  44. scripts/release_testing_setup.sh release_testing
  45. - name: Clean spec repo
  46. run: |
  47. git clone --quiet https://"$botaccess"@github.com/Firebase/SpecsReleasing.git "${local_repo}"
  48. cd "${local_repo}"
  49. # Remove all unhidden dirs, i.e. all podspec dir from the spec repo.
  50. rm -Rf -- */
  51. git add .
  52. # commit without diff will throw an error. `git diff --exit-code` can avoid such error.
  53. git diff --staged --exit-code || git commit -m "Empty spec repo."
  54. # Attempt to push. If it fails, print a detailed error message and exit.
  55. git push || {
  56. echo "--------------------------------------------------------------------------------"
  57. echo "ERROR: Failed to push to Firebase/SpecsReleasing."
  58. echo "This is likely due to an expired Personal Access Token (PAT)."
  59. echo "Please take the following steps to resolve this:"
  60. echo "1. Refresh the OSS bot's scoped access token for the Firebase/SpecsReleasing repo."
  61. echo " This can be done in the OSS bot's GitHub account settings. Ensure the token "
  62. echo " has the 'public_repo' scope."
  63. echo "2. Update the 'RELEASE_TESTING_PAT' secret in this repo's settings."
  64. echo " (https://github.com/Firebase/firebase-ios-sdk/settings/secrets/actions)"
  65. echo "--------------------------------------------------------------------------------"
  66. exit 1
  67. }
  68. - uses: actions/upload-artifact@v4
  69. with:
  70. name: firebase-ios-sdk
  71. path: |
  72. *.podspec
  73. *.podspec.json
  74. buildup_SpecsReleasing_repo_FirebaseCore:
  75. needs: specs_checking
  76. # Don't run on private repo unless it is a PR.
  77. if: github.repository == 'Firebase/firebase-ios-sdk'
  78. runs-on: macos-15
  79. env:
  80. botaccess: ${{ secrets.RELEASE_TESTING_PAT }}
  81. local_repo: specsreleasing
  82. local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
  83. targeted_pod: FirebaseCore
  84. steps:
  85. - uses: actions/checkout@v4
  86. - name: Set Xcode version
  87. run: sudo xcode-select -s /Applications/Xcode_16.4.app
  88. - uses: actions/download-artifact@v4.1.7
  89. with:
  90. name: firebase-ios-sdk
  91. path: ${{ env.local_sdk_repo_dir }}
  92. - name: Update SpecsReleasing repo
  93. run: |
  94. cd scripts/create_spec_repo/
  95. swift build
  96. pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsReleasing.git
  97. BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
  98. --sdk-repo "${local_sdk_repo_dir}" \
  99. --local-spec-repo-name "${local_repo}" \
  100. --pod-sources 'https://github.com/Firebase/SpecsReleasing' "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
  101. --include-pods "${targeted_pod}" --keep-repo
  102. - name: Clean Artifacts
  103. if: ${{ always() }}
  104. run: pod repo remove "${local_repo}"
  105. buildup_SpecsReleasing_repo:
  106. needs: [buildup_SpecsReleasing_repo_FirebaseCore, specs_checking]
  107. # Don't run on private repo unless it is a PR.
  108. if: github.repository == 'Firebase/firebase-ios-sdk' || github.event_name == 'workflow_dispatch'
  109. runs-on: macos-15
  110. strategy:
  111. fail-fast: false
  112. matrix: ${{fromJson(needs.specs_checking.outputs.matrix)}}
  113. env:
  114. botaccess: ${{ secrets.RELEASE_TESTING_PAT }}
  115. local_repo: specsreleasing
  116. local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
  117. targeted_pod: ${{ matrix.podspec }}
  118. steps:
  119. - uses: actions/checkout@v4
  120. - name: Set Xcode version
  121. run: sudo xcode-select -s /Applications/Xcode_16.4.app
  122. - uses: actions/download-artifact@v4.1.7
  123. with:
  124. name: firebase-ios-sdk
  125. path: ${{ env.local_sdk_repo_dir }}
  126. # Addresses flaky pushes due to missing git config on runner.
  127. - name: Set git config
  128. run: |
  129. git config --global user.email "google-oss-bot@example.com"
  130. git config --global user.name "google-oss-bot"
  131. - name: Update SpecsReleasing repo
  132. run: |
  133. [[ ${{ matrix.allowwarnings }} == true ]] && ALLOWWARNINGS=true
  134. cd scripts/create_spec_repo/
  135. swift build
  136. pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsReleasing.git
  137. # ${ALLOWWARNINGS:+--allow-warnings} will add --allow-warnings to the
  138. # command if ${ALLOWWARNINGS} is not null.
  139. BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
  140. --sdk-repo "${local_sdk_repo_dir}" \
  141. --local-spec-repo-name "${local_repo}" \
  142. --pod-sources 'https://github.com/Firebase/SpecsReleasing' "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
  143. --include-pods "${targeted_pod}" \
  144. --keep-repo ${ALLOWWARNINGS:+--allow-warnings}
  145. - name: Clean Artifacts
  146. if: ${{ always() }}
  147. run: pod repo remove "${local_repo}"
  148. quickstart:
  149. # Don't run on private repo unless it is a PR.
  150. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
  151. needs: buildup_SpecsReleasing_repo
  152. strategy:
  153. matrix:
  154. include:
  155. - product: Performance
  156. run_tests: true
  157. swift: true
  158. - product: Storage
  159. run_tests: true
  160. swift: true
  161. is_legacy: true
  162. - product: Config
  163. run_tests: true
  164. objc: true
  165. - product: Messaging
  166. run_tests: false
  167. objc: true
  168. swift: true
  169. - product: InAppMessaging
  170. run_tests: true
  171. objc: true
  172. swift: true
  173. - product: Firestore
  174. run_tests: false
  175. objc: true
  176. - product: Database
  177. run_tests: false
  178. objc: true
  179. swift: true
  180. - product: Authentication
  181. run_tests: false
  182. objc: true
  183. - product: Crashlytics
  184. run_tests: true
  185. swift: true
  186. is_legacy: true
  187. setup_command: |
  188. mkdir -p quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics
  189. # Set the deployed pod location of run and upload-symbols with the development pod version.
  190. cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/
  191. cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/
  192. - product: ABTesting
  193. run_tests: true
  194. objc: true
  195. is_legacy: true
  196. env:
  197. plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  198. botaccess: ${{ secrets.RELEASE_TESTING_PAT }}
  199. LEGACY: ${{ matrix.is_legacy && true || '' }}
  200. runs-on: macos-15
  201. steps:
  202. - uses: actions/checkout@v4
  203. - name: Set Xcode version
  204. run: sudo xcode-select -s /Applications/Xcode_16.4.app
  205. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  206. - name: Setup testing repo and quickstart
  207. run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh ${{ matrix.product }} nightly_release_testing
  208. - name: Install Secret GoogleService-Info.plist
  209. run: |
  210. scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-${{ matrix.product }}.plist.gpg \
  211. quickstart-ios/${{ matrix.product }}/GoogleService-Info.plist "$plist_secret"
  212. - name: Run setup command, if needed.
  213. if: matrix.setup_command != ''
  214. run: ${{ matrix.setup_command }}
  215. - name: Build Obj-C quickstart
  216. if: matrix.objc == true
  217. uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  218. with:
  219. timeout_minutes: 15
  220. max_attempts: 3
  221. retry_wait_seconds: 120
  222. command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }}
  223. - name: Build Swift quickstart
  224. if: matrix.swift == true
  225. uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  226. with:
  227. timeout_minutes: 15
  228. max_attempts: 3
  229. retry_wait_seconds: 120
  230. command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} swift
  231. - name: Remove data before upload
  232. if: ${{ failure() }}
  233. run: scripts/remove_data.sh ${{ matrix.product }}
  234. - uses: actions/upload-artifact@v4
  235. if: ${{ failure() }}
  236. with:
  237. name: quickstart_artifacts_${{ matrix.product }}
  238. path: quickstart-ios/
  239. # TODO: The functions quickstart uses Material which isn't supported by Xcode 15
  240. # functions_quickstart:
  241. # # Don't run on private repo unless it is a PR.
  242. # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
  243. # needs: buildup_SpecsReleasing_repo
  244. # env:
  245. # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  246. # botaccess: ${{ secrets.RELEASE_TESTING_PAT }}
  247. # LEGACY: true
  248. # runs-on: macos-12
  249. # steps:
  250. # - uses: actions/checkout@v4
  251. # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  252. # - name: Setup testing repo and quickstart
  253. # run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh functions nightly_release_testing
  254. # - name: install secret googleservice-info.plist
  255. # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-functions.plist.gpg \
  256. # quickstart-ios/functions/GoogleService-Info.plist "$plist_secret"
  257. # - name: Setup custom URL scheme
  258. # run: sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist
  259. # - name: Test objc quickstart
  260. # run: ([ -z $plist_secret ] ||
  261. # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true)
  262. # - name: Test swift quickstart
  263. # run: ([ -z $plist_secret ] ||
  264. # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true swift)
  265. # - name: Remove data before upload
  266. # if: ${{ failure() }}
  267. # run: scripts/remove_data.sh functions
  268. # - uses: actions/upload-artifact@v4
  269. # if: ${{ failure() }}
  270. # with:
  271. # name: quickstart_artifacts_functions
  272. # path: quickstart-ios/