firebaseai.yml 5.7 KB

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