database.yml 6.0 KB

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