firebaseai.yml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. name: firebaseai
  2. on:
  3. pull_request:
  4. paths:
  5. - 'FirebaseAI**'
  6. - '.github/workflows/firebaseai.yml'
  7. - 'scripts/quickstart_build_spm.sh'
  8. - 'scripts/quickstart_spm_xcodeproj.sh'
  9. - 'Gemfile*'
  10. schedule:
  11. # Run every day at 11pm (PST) - cron uses UTC times
  12. - cron: '0 7 * * *'
  13. workflow_dispatch:
  14. concurrency:
  15. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  16. cancel-in-progress: true
  17. permissions:
  18. contents: read # Needed for actions/checkout
  19. actions: write # Needed for actions/cache (save and restore)
  20. jobs:
  21. spm-package-resolved:
  22. runs-on: macos-14
  23. outputs:
  24. cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
  25. env:
  26. FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
  27. steps:
  28. - uses: actions/checkout@v4
  29. - name: Generate Swift Package.resolved
  30. id: swift_package_resolve
  31. run: |
  32. swift package resolve
  33. - name: Generate cache key
  34. id: generate_cache_key
  35. run: |
  36. cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
  37. echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
  38. - uses: actions/cache/save@v4
  39. id: cache
  40. with:
  41. path: .build
  42. key: ${{ steps.generate_cache_key.outputs.cache_key }}
  43. spm-unit:
  44. strategy:
  45. matrix:
  46. include:
  47. - os: macos-14
  48. xcode: Xcode_16.2
  49. target: iOS
  50. - os: macos-15
  51. xcode: Xcode_16.3
  52. target: iOS
  53. - os: macos-15
  54. xcode: Xcode_16.3
  55. target: tvOS
  56. - os: macos-15
  57. xcode: Xcode_16.3
  58. target: macOS
  59. - os: macos-15
  60. xcode: Xcode_16.3
  61. target: watchOS
  62. - os: macos-15
  63. xcode: Xcode_16.3
  64. target: catalyst
  65. - os: macos-15
  66. xcode: Xcode_16.3
  67. target: visionOS
  68. runs-on: ${{ matrix.os }}
  69. needs: spm-package-resolved
  70. env:
  71. FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
  72. steps:
  73. - uses: actions/checkout@v4
  74. - uses: actions/cache/restore@v4
  75. with:
  76. path: .build
  77. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  78. - name: Clone mock responses
  79. run: scripts/update_vertexai_responses.sh
  80. - name: Xcode
  81. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  82. - name: Install visionOS, if needed.
  83. if: matrix.target == 'visionOS'
  84. run: xcodebuild -downloadPlatform visionOS
  85. - name: Initialize xcodebuild
  86. run: scripts/setup_spm_tests.sh
  87. - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  88. with:
  89. timeout_minutes: 120
  90. max_attempts: 3
  91. retry_on: error
  92. retry_wait_seconds: 120
  93. command: scripts/build.sh FirebaseAIUnit ${{ matrix.target }} spm
  94. testapp-integration:
  95. strategy:
  96. matrix:
  97. target: [iOS]
  98. os: [macos-15]
  99. include:
  100. - os: macos-15
  101. xcode: Xcode_16.3
  102. runs-on: ${{ matrix.os }}
  103. needs: spm-package-resolved
  104. env:
  105. TEST_RUNNER_FIRAAppCheckDebugToken: ${{ secrets.VERTEXAI_INTEGRATION_FAC_DEBUG_TOKEN }}
  106. TEST_RUNNER_VTXIntegrationImagen: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
  107. FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
  108. secrets_passphrase: ${{ secrets.GHASecretsGPGPassphrase1 }}
  109. steps:
  110. - uses: actions/checkout@v4
  111. - uses: actions/cache/restore@v4
  112. with:
  113. path: .build
  114. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  115. - name: Install Secret GoogleService-Info.plist
  116. run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info.plist.gpg \
  117. FirebaseAI/Tests/TestApp/Resources/GoogleService-Info.plist "$secrets_passphrase"
  118. - name: Install Secret GoogleService-Info-Spark.plist
  119. run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-GoogleService-Info-Spark.plist.gpg \
  120. FirebaseAI/Tests/TestApp/Resources/GoogleService-Info-Spark.plist "$secrets_passphrase"
  121. - name: Install Secret Credentials.swift
  122. run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/VertexAI/TestApp-Credentials.swift.gpg \
  123. FirebaseAI/Tests/TestApp/Tests/Integration/Credentials.swift "$secrets_passphrase"
  124. - name: Xcode
  125. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  126. - name: Run IntegrationTests
  127. run: scripts/build.sh FirebaseAIIntegration ${{ matrix.target }}
  128. pod-lib-lint:
  129. # Don't run on private repo unless it is a PR.
  130. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  131. strategy:
  132. matrix:
  133. include:
  134. - os: macos-14
  135. xcode: Xcode_16.2
  136. swift_version: 5.9
  137. warnings:
  138. - os: macos-15
  139. xcode: Xcode_16.3
  140. swift_version: 5.9
  141. warnings:
  142. - os: macos-15
  143. xcode: Xcode_16.3
  144. swift_version: 6.0
  145. warnings:
  146. runs-on: ${{ matrix.os }}
  147. steps:
  148. - uses: actions/checkout@v4
  149. - name: Clone mock responses
  150. run: scripts/update_vertexai_responses.sh
  151. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  152. - name: Setup Bundler
  153. run: scripts/setup_bundler.sh
  154. - name: Xcode
  155. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  156. - name: Set Swift swift_version
  157. run: sed -i "" "s#s.swift_version = '5.9'#s.swift_version = '${{ matrix.swift_version}}'#" FirebaseAI.podspec
  158. - name: Build and test
  159. run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAI.podspec --platforms=${{ matrix.target }} ${{ matrix.warnings }}
  160. quickstart:
  161. # Verifies the quickstart builds with this PR. Only run on pulls where branch is available.
  162. if: github.event_name == 'pull_request'
  163. runs-on: macos-15
  164. env:
  165. BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  166. steps:
  167. - uses: actions/checkout@v4
  168. - name: Build Quickstart
  169. run: scripts/quickstart_build_spm.sh FirebaseAI