database.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. name: database
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. paths:
  6. - 'FirebaseDatabase**'
  7. - 'Firebase/Database/**'
  8. - 'FirebaseSharedSwift**'
  9. - 'Example/Database/**'
  10. - 'FirebaseAuth/Interop/*.h'
  11. - '.github/workflows/database.yml'
  12. - 'Gemfile*'
  13. - 'scripts/run_database_emulator.sh'
  14. schedule:
  15. # Run every day at 2am (PST) - cron uses UTC times
  16. - cron: '0 10 * * *'
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  19. cancel-in-progress: true
  20. jobs:
  21. pod-lib-lint:
  22. # Don't run on private repo unless it is a PR.
  23. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  24. strategy:
  25. matrix:
  26. target: [ios, tvos, macos --skip-tests, watchos]
  27. build-env:
  28. - os: macos-14
  29. xcode: Xcode_16.2
  30. - os: macos-15
  31. xcode: Xcode_16.2
  32. runs-on: ${{ matrix.build-env.os }}
  33. steps:
  34. - uses: actions/checkout@v4
  35. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  36. - name: Setup Bundler
  37. run: scripts/setup_bundler.sh
  38. - name: Xcode
  39. run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
  40. - name: Build and test
  41. run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseDatabase.podspec --test-specs=unit --platforms=${{ matrix.target }}
  42. integration:
  43. # Don't run on private repo unless it is a PR.
  44. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  45. runs-on: macos-15
  46. steps:
  47. - uses: actions/checkout@v4
  48. - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
  49. with:
  50. cache_key: integration${{ matrix.os }}
  51. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  52. - name: Setup Bundler
  53. run: scripts/setup_bundler.sh
  54. - name: Install xcpretty
  55. run: gem install xcpretty
  56. - name: Xcode
  57. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  58. - name: IntegrationTest
  59. # Only iOS to mitigate flakes.
  60. run: scripts/third_party/travis/retry.sh scripts/build.sh Database iOS integration
  61. spm-package-resolved:
  62. env:
  63. FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
  64. runs-on: macos-14
  65. outputs:
  66. cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
  67. steps:
  68. - uses: actions/checkout@v4
  69. - name: Xcode
  70. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  71. - name: Generate Swift Package.resolved
  72. id: swift_package_resolve
  73. run: |
  74. swift package resolve
  75. - name: Generate cache key
  76. id: generate_cache_key
  77. run: |
  78. cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
  79. echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
  80. - uses: actions/cache/save@v4
  81. id: cache
  82. with:
  83. path: .build
  84. key: ${{ steps.generate_cache_key.outputs.cache_key }}
  85. spm:
  86. # Don't run on private repo unless it is a PR.
  87. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  88. needs: [spm-package-resolved]
  89. strategy:
  90. matrix:
  91. include:
  92. - os: macos-14
  93. xcode: Xcode_16.2
  94. target: iOS
  95. - os: macos-15
  96. xcode: Xcode_16.2
  97. target: iOS
  98. - os: macos-15
  99. xcode: Xcode_16.2
  100. target: tvOS
  101. - os: macos-15
  102. xcode: Xcode_16.2
  103. target: macOS
  104. - os: macos-15
  105. xcode: Xcode_16.2
  106. target: watchOS
  107. - os: macos-15
  108. xcode: Xcode_16.2
  109. target: catalyst
  110. - os: macos-15
  111. xcode: Xcode_16.2
  112. target: visionOS
  113. runs-on: ${{ matrix.os }}
  114. steps:
  115. - uses: actions/checkout@v4
  116. - uses: actions/cache/restore@v4
  117. with:
  118. path: .build
  119. key: ${{needs.spm-package-resolved.outputs.cache_key}}
  120. - name: Xcode
  121. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  122. - name: Initialize xcodebuild
  123. run: scripts/setup_spm_tests.sh
  124. - name: Unit Tests
  125. run: scripts/third_party/travis/retry.sh ./scripts/build.sh DatabaseUnit ${{ matrix.target }} spm
  126. - name: iOS Swift Unit Tests
  127. run: scripts/third_party/travis/retry.sh ./scripts/build.sh DatabaseUnitSwift ${{ matrix.target }} spm
  128. catalyst:
  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. runs-on: macos-15
  132. steps:
  133. - uses: actions/checkout@v4
  134. - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
  135. with:
  136. cache_key: catalyst${{ matrix.os }}
  137. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  138. - name: Setup Bundler
  139. run: scripts/setup_bundler.sh
  140. - name: Xcode
  141. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  142. - name: Setup project and Build for Catalyst
  143. run: scripts/test_catalyst.sh FirebaseDatabase test FirebaseDatabase-Unit-unit
  144. quickstart:
  145. # Don't run on private repo unless it is a PR.
  146. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  147. env:
  148. plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  149. signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  150. runs-on: macos-15
  151. steps:
  152. - uses: actions/checkout@v4
  153. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  154. - name: Setup quickstart
  155. run: scripts/setup_quickstart.sh database
  156. - name: Install Secret GoogleService-Info.plist
  157. run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-database.plist.gpg \
  158. quickstart-ios/database/GoogleService-Info.plist "$plist_secret"
  159. - name: Xcode
  160. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  161. - name: Test objc quickstart
  162. run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Database false)
  163. - name: Test swift quickstart
  164. run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Database false swift)
  165. database-cron-only:
  166. # Don't run on private repo.
  167. if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
  168. runs-on: macos-15
  169. strategy:
  170. matrix:
  171. podspec: [FirebaseDatabase.podspec]
  172. target: [ios, tvos, macos]
  173. flags: [
  174. '--skip-tests --use-static-frameworks'
  175. ]
  176. needs: pod-lib-lint
  177. steps:
  178. - uses: actions/checkout@v4
  179. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  180. - name: Xcode
  181. run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
  182. - name: Setup Bundler
  183. run: scripts/setup_bundler.sh
  184. - name: PodLibLint database Cron
  185. run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }} --platforms=${{ matrix.target }} ${{ matrix.flags }}