common_cocoapods.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. name: common_cocoapods
  2. permissions:
  3. contents: read
  4. on:
  5. workflow_call:
  6. # Re-usable workflows do not automatically inherit the caller's secrets.
  7. #
  8. # If the calling workflow uses a secret in the `setup_command` input, then
  9. # it also must pass the secret to the re-usable workflow.
  10. #
  11. # Example:
  12. #
  13. # pod_lib_lint:
  14. # uses: ./.github/workflows/common_cocoapods.yml
  15. # with:
  16. # product: FirebaseFoo
  17. # setup_command: |
  18. # scripts/decrypt_gha_secret.sh \
  19. # /path/to/GoogleService-Info.plist.gpg \
  20. # /path/to/dest/GoogleService-Info.plist "$plist_secret"
  21. # secrets:
  22. # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  23. #
  24. secrets:
  25. plist_secret:
  26. required: false
  27. inputs:
  28. # The product to test be tested (e.g. `FirebaseABTesting`).
  29. product:
  30. type: string
  31. required: true
  32. # The platforms to build on. Defaults to all.
  33. # To target specific platforms, pass a comma or space separated string of
  34. # platforms.
  35. #
  36. # Examples:
  37. # - build/test only for macOS: `macOS`
  38. # - build/test only for macOS and tvOS: `macOS, tvOS`
  39. platforms:
  40. type: string
  41. required: false
  42. default: "iOS, tvOS, macOS, watchOS"
  43. # By default, all platforms will be tested (see matrix in `spm` job).
  44. # To build instead of test, pass a comma or space separated string of
  45. # platforms.
  46. #
  47. # Platform options: [iOS, tvOS, macOS, watchOS, catalyst, visionOS]
  48. #
  49. # Note: Build-only platforms must be represented in the `platforms` input
  50. # (which defaults to all platforms) in order to take effect.
  51. #
  52. # Examples:
  53. # - build only for macOS: `macOS`
  54. # - build only for macOS and tvOS: `macOS, tvOS`
  55. # - build only for all platforms: `all`
  56. buildonly_platforms:
  57. type: string
  58. required: false
  59. default: ""
  60. # Whether to lint with `--allow-warnings`. Defaults to false.
  61. allow_warnings:
  62. type: boolean
  63. required: false
  64. default: false
  65. # Whether to lint with `--analyze`. Defaults to true.
  66. analyze:
  67. type: boolean
  68. required: false
  69. default: true
  70. # Whether to lint with `--verbose`. Defaults to false.
  71. verbose:
  72. type: boolean
  73. required: false
  74. default: false
  75. # Whether to additionally build with Swift 6. Defaults to false.
  76. supports_swift6:
  77. type: boolean
  78. required: false
  79. default: false
  80. # A comma separated (no spaces) string that will be passed to
  81. # pod lib lint's `--test-specs=` argument. By default, all
  82. # test specs will be tested.
  83. test_specs:
  84. type: string
  85. required: false
  86. default: ""
  87. # A command to execute before testing.
  88. #
  89. # This is useful for additional set up, like starting an emulator or
  90. # downloading test data.
  91. #
  92. # Note, this step has an env var set to decrypt plists. Use
  93. # "$plist_secret" in the given command. See `secrets` documentation
  94. # at top of this file.
  95. #
  96. # Example: `FirebaseFunctions/Backend/start.sh synchronous`
  97. setup_command:
  98. type: string
  99. required: false
  100. default: ""
  101. # The timeout (in minutes) for the linting to complete. Defaults to 15.
  102. timeout_minutes:
  103. type: number
  104. required: false
  105. default: 15
  106. jobs:
  107. pod-lib-lint:
  108. # Run on the main repo's scheduled jobs or pull requests and manual workflow invocations.
  109. if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name)
  110. strategy:
  111. matrix:
  112. os: [macos-15]
  113. xcode: [Xcode_16.4]
  114. platform: [iOS, tvOS, macOS, watchOS]
  115. include:
  116. - os: macos-14
  117. xcode: Xcode_16.2
  118. platform: iOS
  119. runs-on: ${{ matrix.os }}
  120. steps:
  121. - uses: actions/checkout@v4
  122. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  123. - name: Setup Bundler
  124. run: scripts/setup_bundler.sh
  125. - name: Xcode
  126. run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
  127. - name: Set conditional environment variable, if needed.
  128. if: inputs.product == 'FirebaseAuth'
  129. run: echo "FIREBASE_CI=true" >> $GITHUB_ENV
  130. - name: Set podspec Swift version to 6.0, if supported.
  131. if: inputs.supports_swift6 == true && matrix.os != 'macos-14'
  132. run: sed -i "" "s/s.swift_version[[:space:]]*=[[:space:]]*'5.9'/s.swift_version = '6.0'/" ${{ inputs.product }}.podspec
  133. - name: Run setup command, if needed.
  134. if: inputs.setup_command != ''
  135. env:
  136. plist_secret: ${{ secrets.plist_secret }}
  137. run: ${{ inputs.setup_command }}
  138. - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  139. if: contains(join(inputs.platforms), matrix.platform) || matrix.os == 'macos-14'
  140. with:
  141. timeout_minutes: ${{ inputs.timeout_minutes }}
  142. max_attempts: 3
  143. retry_wait_seconds: 120
  144. command: |
  145. scripts/pod_lib_lint.rb ${{ inputs.product }}.podspec --platforms=${{ matrix.platform }} \
  146. ${{ inputs.allow_warnings == true && '--allow-warnings' || '' }} \
  147. ${{ inputs.verbose == true && '--verbose' || '' }} \
  148. ${{ inputs.analyze == false && '--no-analyze' || '' }} \
  149. ${{ inputs.test_specs != '' && format('--test-specs={0}', inputs.test_specs) || '' }} \
  150. ${{ (contains(inputs.buildonly_platforms, matrix.platform) || contains(inputs.buildonly_platforms, 'all')) && '--skip-tests' || '' }}