firestore.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. # Copyright 2020 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. name: firestore
  15. on:
  16. pull_request:
  17. schedule:
  18. # Run every day at 12am (PST) - cron uses UTC times
  19. - cron: '0 8 * * *'
  20. concurrency:
  21. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  22. cancel-in-progress: true
  23. jobs:
  24. changes:
  25. runs-on: macos-12
  26. # Only when this is not a scheduled run
  27. if: github.event_name != 'schedule'
  28. outputs:
  29. changed: ${{ steps.changes.outputs.changed }}
  30. steps:
  31. - uses: dorny/paths-filter@v2
  32. id: changes
  33. with:
  34. filters: |
  35. changed:
  36. # Firestore sources
  37. - 'Firestore/**'
  38. # Interop headers
  39. - 'FirebaseAuth/Interop/*.h'
  40. # FirebaseCore header change
  41. - 'FirebaseCore/Internal'
  42. - 'FirebaseCore/Sources/Public'
  43. # Podspec
  44. - 'FirebaseFirestore.podspec'
  45. # CMake
  46. - '**CMakeLists.txt'
  47. - 'cmake/**'
  48. # Build scripts to which Firestore is sensitive
  49. #
  50. # Note that this doesn't include check scripts because changing those will
  51. # already trigger the check workflow.
  52. - 'scripts/binary_to_array.py'
  53. - 'scripts/build.sh'
  54. - 'scripts/install_prereqs.sh'
  55. - 'scripts/localize_podfile.swift'
  56. - 'scripts/pod_lib_lint.rb'
  57. - 'scripts/run_firestore_emulator.sh'
  58. - 'scripts/setup_*'
  59. - 'scripts/sync_project.rb'
  60. - 'scripts/test_quickstart.sh'
  61. - 'scripts/xcresult_logs.py'
  62. # This workflow
  63. - '.github/workflows/firestore.yml'
  64. # Rebuild on Ruby infrastructure changes.
  65. - 'Gemfile*'
  66. check:
  67. needs: changes
  68. # Either a scheduled run from public repo, or a pull request with firestore changes.
  69. if: |
  70. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  71. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  72. runs-on: macos-12
  73. steps:
  74. - uses: actions/checkout@v3
  75. - uses: actions/setup-python@v4
  76. with:
  77. python-version: 3.11
  78. - name: Setup check
  79. run: scripts/setup_check.sh
  80. - name: Run check
  81. run: scripts/check.sh --test-only
  82. cmake:
  83. needs: check
  84. # Either a scheduled run from public repo, or a pull request with firestore changes.
  85. if: |
  86. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  87. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  88. strategy:
  89. matrix:
  90. os: [macos-12, ubuntu-latest]
  91. env:
  92. MINT_PATH: ${{ github.workspace }}/mint
  93. runs-on: ${{ matrix.os }}
  94. steps:
  95. - uses: actions/checkout@v3
  96. - name: Prepare ccache
  97. uses: actions/cache@v3
  98. with:
  99. path: ${{ runner.temp }}/ccache
  100. key: firestore-ccache-${{ runner.os }}-${{ github.sha }}
  101. restore-keys: |
  102. firestore-ccache-${{ runner.os }}-
  103. - name: Cache Mint packages
  104. uses: actions/cache@v3
  105. with:
  106. path: ${{ env.MINT_PATH }}
  107. key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
  108. restore-keys: ${{ runner.os }}-mint-
  109. - name: Setup build
  110. run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake
  111. - name: Build and test
  112. run: |
  113. export CCACHE_DIR=${{ runner.temp }}/ccache
  114. scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
  115. cmake-prod-db:
  116. # Either a scheduled run from public repo, or a pull request with firestore changes.
  117. if: |
  118. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  119. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  120. needs: check
  121. strategy:
  122. matrix:
  123. os: [macos-12]
  124. databaseId: [(default), test-db]
  125. env:
  126. plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  127. MINT_PATH: ${{ github.workspace }}/mint
  128. TARGET_DATABASE_ID: ${{ matrix.databaseId }}
  129. runs-on: ${{ matrix.os }}
  130. steps:
  131. - uses: actions/checkout@v3
  132. - name: Prepare ccache
  133. uses: actions/cache@v3
  134. with:
  135. path: ${{ runner.temp }}/ccache
  136. key: firestore-ccache-${{ matrix.databaseId }}-${{ runner.os }}-${{ github.sha }}
  137. restore-keys: |
  138. firestore-ccache-${{ matrix.databaseId }}-${{ runner.os }}-
  139. - name: Cache Mint packages
  140. uses: actions/cache@v3
  141. with:
  142. path: ${{ env.MINT_PATH }}
  143. key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
  144. restore-keys: ${{ runner.os }}-mint-
  145. - name: Install Secret GoogleService-Info.plist
  146. run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/firestore.plist.gpg \
  147. Firestore/Example/App/GoogleService-Info.plist "$plist_secret"
  148. - name: Setup build
  149. run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake
  150. - name: Build and test
  151. run: |
  152. export CCACHE_DIR=${{ runner.temp }}/ccache
  153. scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
  154. sanitizers:
  155. # Either a scheduled run from public repo, or a pull request with firestore changes.
  156. if: |
  157. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  158. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  159. needs: check
  160. strategy:
  161. matrix:
  162. # TODO(b/260248007): Re-enable this once tsan passes on Linux
  163. os: [macos-12]
  164. sanitizer: [asan, tsan]
  165. runs-on: ${{ matrix.os }}
  166. env:
  167. SANITIZERS: ${{ matrix.sanitizer }}
  168. steps:
  169. - uses: actions/checkout@v3
  170. - name: Prepare ccache
  171. uses: actions/cache@v3
  172. with:
  173. path: ${{ runner.temp }}/ccache
  174. key: ${{ matrix.sanitizer }}-firestore-ccache-${{ runner.os }}-${{ github.sha }}
  175. restore-keys: |
  176. ${{ matrix.sanitizer }}-firestore-ccache-${{ runner.os }}-
  177. - name: Setup build
  178. run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake
  179. - name: Build and test
  180. run: |
  181. export CCACHE_DIR=${{ runner.temp }}/ccache
  182. scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
  183. xcodebuild:
  184. # Either a scheduled run from public repo, or a pull request with firestore changes.
  185. if: |
  186. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  187. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  188. runs-on: macos-12
  189. needs: check
  190. strategy:
  191. matrix:
  192. target: [iOS, tvOS, macOS]
  193. steps:
  194. - uses: actions/checkout@v3
  195. - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
  196. with:
  197. cache_key: ${{ matrix.target }}
  198. - uses: ruby/setup-ruby@v1
  199. - name: Setup build
  200. run: scripts/install_prereqs.sh Firestore ${{ matrix.target }} xcodebuild
  201. - name: Build and test
  202. run: scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ matrix.target }} xcodebuild
  203. pod-lib-lint:
  204. # Either a scheduled run from public repo, or a pull request with firestore changes.
  205. if: |
  206. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  207. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  208. runs-on: macos-12
  209. needs: check
  210. strategy:
  211. matrix:
  212. podspec: [
  213. 'FirebaseFirestore.podspec',
  214. 'FirebaseFirestoreSwift.podspec',
  215. ]
  216. steps:
  217. - uses: actions/checkout@v3
  218. - uses: ruby/setup-ruby@v1
  219. - name: Setup Bundler
  220. run: ./scripts/setup_bundler.sh
  221. - name: Pod lib lint
  222. # TODO(#9565, b/227461966): Remove --no-analyze when absl is fixed.
  223. run: |
  224. scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }} \
  225. --platforms=ios \
  226. --allow-warnings \
  227. --no-analyze
  228. # `pod lib lint` takes a long time so only run the other platforms and static frameworks build in the cron.
  229. pod-lib-lint-cron:
  230. if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
  231. runs-on: macos-12
  232. needs: check
  233. strategy:
  234. matrix:
  235. podspec: [
  236. 'FirebaseFirestore.podspec',
  237. 'FirebaseFirestoreSwift.podspec',
  238. ]
  239. platforms: [
  240. 'macos',
  241. 'tvos',
  242. ]
  243. flags: [
  244. '--use-static-frameworks',
  245. '',
  246. ]
  247. steps:
  248. - uses: actions/checkout@v3
  249. - uses: ruby/setup-ruby@v1
  250. - name: Setup Bundler
  251. run: ./scripts/setup_bundler.sh
  252. - name: Pod lib lint
  253. # TODO(#9565, b/227461966): Remove --no-analyze when absl is fixed.
  254. run: |
  255. scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }}\
  256. ${{ matrix.flags }} \
  257. --platforms=${{ matrix.platforms }} \
  258. --allow-warnings \
  259. --no-analyze
  260. spm:
  261. # Either a scheduled run from public repo, or a pull request with firestore changes.
  262. if: |
  263. (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
  264. (github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
  265. runs-on: macos-12
  266. needs: check
  267. steps:
  268. - uses: actions/checkout@v3
  269. - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
  270. with:
  271. cache_key: ${{ matrix.os }}
  272. - name: Initialize xcodebuild
  273. run: scripts/setup_spm_tests.sh
  274. - name: iOS Build Test – Binary
  275. run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestore iOS spmbuildonly
  276. - name: iOS Build Test – Source
  277. run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestore iOS spmbuildonly
  278. env:
  279. FIREBASE_SOURCE_FIRESTORE: 1
  280. - name: Swift Build
  281. run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestoreSwift iOS spmbuildonly
  282. spm-cron:
  283. # Don't run on private repo.
  284. if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
  285. runs-on: macos-12
  286. strategy:
  287. matrix:
  288. target: [tvOS, macOS, catalyst]
  289. steps:
  290. - uses: actions/checkout@v3
  291. - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
  292. with:
  293. cache_key: ${{ matrix.os }}
  294. - name: Initialize xcodebuild
  295. run: scripts/setup_spm_tests.sh
  296. - name: Build Test - Binary
  297. run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestore ${{ matrix.target }} spmbuildonly
  298. # TODO: Re-enable either in or after #11706.
  299. # - name: Build Test – Source
  300. # run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestore ${{ matrix.target }} spmbuildonly
  301. # env:
  302. # FIREBASE_SOURCE_FIRESTORE: 1
  303. - name: Swift Build
  304. run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestoreSwift ${{ matrix.target }} spmbuildonly
  305. # A job that fails if any required job in the test matrix fails,
  306. # to be used as a required check for merging.
  307. check-required-tests:
  308. runs-on: ubuntu-latest
  309. if: always()
  310. name: Check all required Firestore tests results
  311. needs: [cmake, cmake-prod-db, xcodebuild, spm]
  312. steps:
  313. - name: Check test matrix
  314. if: needs.cmake.result == 'failure' || needs.cmake-prod-db.result == 'failure' || needs.xcodebuild.result == 'failure' || needs.spm.result == 'failure'
  315. run: exit 1
  316. # Disable until FirebaseUI is updated to accept Firebase 9 and quickstart is updated to accept
  317. # Firebase UI 12
  318. # quickstart:
  319. # # Don't run on private repo unless it is a PR.
  320. # if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
  321. # env:
  322. # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  323. # signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  324. # runs-on: macos-12
  325. # needs: check
  326. # steps:
  327. # - uses: actions/checkout@v3
  328. # - name: Setup quickstart
  329. # run: scripts/setup_quickstart.sh firestore
  330. # - name: Install Secret GoogleService-Info.plist
  331. # run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-firestore.plist.gpg \
  332. # quickstart-ios/firestore/GoogleService-Info.plist "$plist_secret"
  333. # - name: Test swift quickstart
  334. # run: ([ -z $plist_secret ] ||
  335. # scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Firestore false)