prerelease.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. name: prerelease
  2. permissions:
  3. contents: write
  4. on:
  5. pull_request:
  6. # closed will be triggered when a pull request is merged. This is to keep https://github.com/firebase/SpecsTesting up to date.
  7. types: [closed]
  8. paths:
  9. - '.github/workflows/prerelease.yml'
  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-15
  24. env:
  25. botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }}
  26. local_repo: specstesting
  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: Xcode
  36. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  37. - name: Generate matrix
  38. id: generate_matrix
  39. run: |
  40. cd "${GITHUB_WORKSPACE}/ReleaseTooling"
  41. swift run manifest --sdk-repo-url "${GITHUB_WORKSPACE}" --output-file-path ./output.json --for-gha-matrix-generation
  42. echo "::set-output name=matrix::{\"include\":$( cat output.json )}"
  43. - name: Update SpecsTesting repo setup
  44. run: |
  45. podspec_repo_branch="${podspec_repo_branch}" \
  46. scripts/release_testing_setup.sh prerelease_testing
  47. env:
  48. BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  49. - name: Clean spec repo
  50. run: |
  51. git clone --quiet https://${botaccess}@github.com/Firebase/SpecsTesting.git "${local_repo}"
  52. cd "${local_repo}"
  53. # Remove all unhidden dirs, i.e. all podspec dir from the spec repo.
  54. rm -Rf -- */
  55. git add .
  56. # commit without diff will throw an error. `git diff --exit-code` can avoid such error.
  57. git diff --staged --exit-code || git commit -m "Empty spec repo."
  58. # Attempt to push. If it fails, print a detailed error message and exit.
  59. git push || {
  60. echo "--------------------------------------------------------------------------------"
  61. echo "ERROR: Failed to push to Firebase/SpecsTesting."
  62. echo "This is likely due to an expired Personal Access Token (PAT)."
  63. echo "Please take the following steps to resolve this:"
  64. echo "1. Refresh the OSS bot's scoped access token for the Firebase/SpecsTesting repo."
  65. echo " This can be done in the OSS bot's GitHub account settings. Ensure the token "
  66. echo " has the 'public_repo' scope."
  67. echo "2. Update the 'PRERELEASE_TESTING_PAT' secret in this repo's settings."
  68. echo " (https://github.com/Firebase/firebase-ios-sdk/settings/secrets/actions)"
  69. echo "--------------------------------------------------------------------------------"
  70. exit 1
  71. }
  72. - name: Clean Artifacts
  73. if: ${{ always() }}
  74. run: |
  75. rm -rf prerelease-testing-token.txt
  76. - uses: actions/upload-artifact@v4
  77. with:
  78. name: firebase-ios-sdk
  79. path: |
  80. *.podspec
  81. *.podspec.json
  82. buildup_SpecsTesting_repo_FirebaseCore:
  83. needs: specs_checking
  84. # Don't run on private repo unless it is a PR.
  85. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
  86. runs-on: macos-15
  87. env:
  88. botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }}
  89. local_repo: specstesting
  90. local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
  91. targeted_pod: FirebaseCore
  92. steps:
  93. - uses: actions/checkout@v4
  94. - name: Xcode
  95. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  96. - uses: actions/download-artifact@v4.1.7
  97. with:
  98. name: firebase-ios-sdk
  99. path: ${{ env.local_sdk_repo_dir }}
  100. # Addresses flaky pushes due to missing git config on runner.
  101. - name: Set git config
  102. run: |
  103. git config --global user.email "google-oss-bot@example.com"
  104. git config --global user.name "google-oss-bot"
  105. - name: Update SpecsTesting repo
  106. run: |
  107. cd scripts/create_spec_repo/
  108. swift build
  109. pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
  110. BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
  111. --sdk-repo "${local_sdk_repo_dir}" \
  112. --local-spec-repo-name "${local_repo}" \
  113. --sdk-repo-name SpecsTesting \
  114. --github-account Firebase \
  115. --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
  116. --include-pods "${targeted_pod}" --keep-repo
  117. - name: Clean Artifacts
  118. if: ${{ always() }}
  119. run: pod repo remove "${local_repo}"
  120. buildup_SpecsTesting_repo:
  121. needs: [buildup_SpecsTesting_repo_FirebaseCore, specs_checking]
  122. # Don't run on private repo unless it is a PR.
  123. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
  124. runs-on: macos-15
  125. strategy:
  126. fail-fast: false
  127. matrix: ${{fromJson(needs.specs_checking.outputs.matrix)}}
  128. env:
  129. botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }}
  130. local_repo: specstesting
  131. local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
  132. targeted_pod: ${{ matrix.podspec }}
  133. steps:
  134. - uses: actions/checkout@v4
  135. - name: Xcode
  136. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  137. - uses: actions/download-artifact@v4.1.7
  138. with:
  139. name: firebase-ios-sdk
  140. path: ${{ env.local_sdk_repo_dir }}
  141. # Addresses flaky pushes due to missing git config on runner.
  142. - name: Set git config
  143. run: |
  144. git config --global user.email "google-oss-bot@example.com"
  145. git config --global user.name "google-oss-bot"
  146. - name: Update SpecsTesting repo
  147. run: |
  148. [[ ${{ matrix.allowwarnings }} == true ]] && ALLOWWARNINGS=true
  149. cd scripts/create_spec_repo/
  150. swift build
  151. pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
  152. # ${ALLOWWARNINGS:+--allow-warnings} will add --allow-warnings to the
  153. # command if ${ALLOWWARNINGS} is not null.
  154. BOT_TOKEN="${botaccess}" ${GITHUB_WORKSPACE}/scripts/third_party/travis/retry.sh .build/debug/spec-repo-builder \
  155. --sdk-repo "${local_sdk_repo_dir}" \
  156. --local-spec-repo-name "${local_repo}" \
  157. --sdk-repo-name SpecsTesting \
  158. --github-account Firebase \
  159. --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
  160. --include-pods "${targeted_pod}" \
  161. --keep-repo ${ALLOWWARNINGS:+--allow-warnings}
  162. - name: Clean Artifacts
  163. if: ${{ always() }}
  164. run: pod repo remove "${local_repo}"
  165. update_SpecsTesting_repo:
  166. # Don't run on private repo unless it is a PR.
  167. if: github.repository == 'Firebase/firebase-ios-sdk' && github.event.pull_request.merged == true
  168. runs-on: macos-15
  169. env:
  170. botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }}
  171. local_repo: specstesting
  172. podspec_repo_branch: main
  173. steps:
  174. - uses: actions/checkout@v4
  175. with:
  176. fetch-depth: 0
  177. - name: Xcode
  178. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  179. - name: Update SpecsTesting repo setup
  180. run: |
  181. # Update/create a nightly tag to the head of the main branch.
  182. podspec_repo_branch="${podspec_repo_branch}" \
  183. scripts/release_testing_setup.sh prerelease_testing
  184. env:
  185. BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  186. - name: Push updated podspecs
  187. run: |
  188. # Changes in post submit tests will be fetched by getting diff between
  189. # the HEAD and HEAD^ of the main branch.
  190. common_commit=$(git rev-parse HEAD^)
  191. git diff --name-only $common_commit remotes/origin/${podspec_repo_branch} > updated_files.txt
  192. updated_podspecs=()
  193. while IFS= read -r line;
  194. do
  195. echo $line
  196. if [ ${line: -8} == ".podspec" ]
  197. then
  198. updated_podspecs+=("$(basename -s .podspec ${line})")
  199. fi
  200. done < updated_files.txt
  201. if [ -z "$updated_podspecs" ]
  202. then
  203. exit
  204. fi
  205. cd scripts/create_spec_repo/
  206. swift build
  207. pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
  208. BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo $(pwd) --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" --keep-repo --include-pods "${updated_podspecs[@]}"
  209. # TODO: The functions quickstart uses Material which isn't supported by Xcode 15
  210. #functions_quickstart:
  211. # Don't run on private repo unless it is a PR.
  212. # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
  213. # needs: buildup_SpecsTesting_repo
  214. # env:
  215. # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  216. # botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }}
  217. # LEGACY: true
  218. # # TODO: The functions quickstart uses Material which isn't supported by Xcode 15
  219. # runs-on: macos-12
  220. # steps:
  221. # - uses: actions/checkout@v4
  222. # - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  223. # - name: Xcode
  224. # run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  225. # - name: Setup testing repo and quickstart
  226. # run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh functions prerelease_testing
  227. # - name: install secret googleservice-info.plist
  228. # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-functions.plist.gpg \
  229. # quickstart-ios/functions/GoogleService-Info.plist "$plist_secret"
  230. # - name: Setup custom URL scheme
  231. # run: sed -i '' 's/REVERSED_CLIENT_ID/com.googleusercontent.apps.1025801074639-6p6ebi8amuklcjrto20gvpe295smm8u6/' quickstart-ios/functions/LegacyFunctionsQuickstart/FunctionsExample/Info.plist
  232. # - name: Test objc quickstart
  233. # run: ([ -z $plist_secret ] ||
  234. # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true)
  235. # - name: Test swift quickstart
  236. # run: ([ -z $plist_secret ] ||
  237. # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Functions true swift)
  238. # - name: Remove data before upload
  239. # if: ${{ failure() }}
  240. # run: scripts/remove_data.sh functions
  241. # - uses: actions/upload-artifact@v4
  242. # if: ${{ failure() }}
  243. # with:
  244. # name: quickstart_artifacts_functions
  245. # path: quickstart-ios/
  246. quickstart:
  247. # Don't run on private repo unless it is a PR.
  248. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch'
  249. needs: buildup_SpecsTesting_repo
  250. strategy:
  251. matrix:
  252. include:
  253. - product: Performance
  254. run_tests: true
  255. swift: true
  256. - product: Storage
  257. is_legacy: true
  258. run_tests: true
  259. swift: true
  260. - product: Config
  261. run_tests: true
  262. objc: true
  263. - product: Messaging
  264. run_tests: false
  265. swift: true
  266. objc: true
  267. - product: InAppMessaging
  268. run_tests: true
  269. swift: true
  270. objc: true
  271. - product: Firestore
  272. run_tests: false
  273. - product: Database
  274. run_tests: false
  275. swift: true
  276. objc: true
  277. - product: Authentication
  278. run_tests: false
  279. objc: true
  280. - product: Crashlytics
  281. is_legacy: true
  282. run_tests: true
  283. objc: false
  284. swift: true
  285. setup_command: |
  286. mkdir -p quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics
  287. # Set the deployed pod location of run and upload-symbols with the development pod version.
  288. cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/
  289. cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/
  290. - product: ABTesting
  291. is_legacy: true
  292. run_tests: true
  293. objc: true
  294. env:
  295. plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  296. botaccess: ${{ secrets.PRERELEASE_TESTING_PAT }}
  297. LEGACY: ${{ matrix.is_legacy && true || '' }}
  298. runs-on: macos-15
  299. steps:
  300. - uses: actions/checkout@v4
  301. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  302. - name: Xcode
  303. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  304. - name: Setup testing repo and quickstart
  305. run: BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh ${{ matrix.product }} prerelease_testing
  306. - name: Install Secret GoogleService-Info.plist
  307. run: |
  308. scripts/decrypt_gha_secret.sh \
  309. scripts/gha-encrypted/qs-${{ matrix.product }}.plist.gpg \
  310. quickstart-ios/${{ matrix.product }}/GoogleService-Info.plist \
  311. "$plist_secret"
  312. - name: Run setup command, if needed.
  313. if: matrix.setup_command != ''
  314. run: ${{ matrix.setup_command }}
  315. - name: Build Swift quickstart
  316. if: matrix.swift == true
  317. uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  318. with:
  319. timeout_minutes: 15
  320. max_attempts: 3
  321. retry_wait_seconds: 120
  322. command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }} swift
  323. - name: Build Obj-C quickstart
  324. if: matrix.objc == true
  325. uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  326. with:
  327. timeout_minutes: 15
  328. max_attempts: 3
  329. retry_wait_seconds: 120
  330. command: scripts/test_quickstart.sh ${{ matrix.product }} ${{ matrix.run_tests }}
  331. # Failure sequence to upload artifact.
  332. - name: Remove data before upload.
  333. if: ${{ failure() }}
  334. run: scripts/remove_data.sh ${{ matrix.product }}
  335. - uses: actions/upload-artifact@v4
  336. if: ${{ failure() }}
  337. with:
  338. name: quickstart_artifacts_${{ matrix.product }}
  339. path: quickstart-ios/