| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- name: common_cocoapods
- permissions:
- contents: read
- on:
- workflow_call:
- # Re-usable workflows do not automatically inherit the caller's secrets.
- #
- # If the calling workflow uses a secret in the `setup_command` input, then
- # it also must pass the secret to the re-usable workflow.
- #
- # Example:
- #
- # pod_lib_lint:
- # uses: ./.github/workflows/common_cocoapods.yml
- # with:
- # product: FirebaseFoo
- # setup_command: |
- # scripts/decrypt_gha_secret.sh \
- # /path/to/GoogleService-Info.plist.gpg \
- # /path/to/dest/GoogleService-Info.plist "$plist_secret"
- # secrets:
- # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
- #
- secrets:
- plist_secret:
- required: false
- inputs:
- # The product to test be tested (e.g. `FirebaseABTesting`).
- product:
- type: string
- required: true
- # The platforms to build on. Defaults to all.
- # To target specific platforms, pass a comma or space separated string of
- # platforms.
- #
- # Examples:
- # - build/test only for macOS: `macOS`
- # - build/test only for macOS and tvOS: `macOS, tvOS`
- platforms:
- type: string
- required: false
- default: "iOS, tvOS, macOS, watchOS"
- # By default, all platforms will be tested (see matrix in `spm` job).
- # To build instead of test, pass a comma or space separated string of
- # platforms.
- #
- # Platform options: [iOS, tvOS, macOS, watchOS, catalyst, visionOS]
- #
- # Note: Build-only platforms must be represented in the `platforms` input
- # (which defaults to all platforms) in order to take effect.
- #
- # Examples:
- # - build only for macOS: `macOS`
- # - build only for macOS and tvOS: `macOS, tvOS`
- # - build only for all platforms: `all`
- buildonly_platforms:
- type: string
- required: false
- default: ""
- # Whether to lint with `--allow-warnings`. Defaults to false.
- allow_warnings:
- type: boolean
- required: false
- default: false
- # Whether to lint with `--analyze`. Defaults to true.
- analyze:
- type: boolean
- required: false
- default: true
- # Whether to additionally build with Swift 6. Defaults to false.
- supports_swift6:
- type: boolean
- required: false
- default: false
- # A comma separated (no spaces) string that will be passed to
- # pod lib lint's `--test-specs=` argument. By default, all
- # test specs will be tested.
- test_specs:
- type: string
- required: false
- default: ""
- # A command to execute before testing.
- #
- # This is useful for additional set up, like starting an emulator or
- # downloading test data.
- #
- # Note, this step has an env var set to decrypt plists. Use
- # "$plist_secret" in the given command. See `secrets` documentation
- # at top of this file.
- #
- # Example: `FirebaseFunctions/Backend/start.sh synchronous`
- setup_command:
- type: string
- required: false
- default: ""
- jobs:
- pod-lib-lint:
- # Run on the main repo's scheduled jobs or pull requests and manual workflow invocations.
- if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name)
- strategy:
- matrix:
- os: [macos-15]
- xcode: [Xcode_16.4]
- platform: [iOS, tvOS, macOS, watchOS]
- include:
- - os: macos-14
- xcode: Xcode_16.2
- platform: iOS
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v4
- - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
- - name: Setup Bundler
- run: scripts/setup_bundler.sh
- - name: Xcode
- run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- - name: Set conditional environment variable, if needed.
- if: inputs.product == 'FirebaseAuth'
- run: echo "FIREBASE_CI=true" >> $GITHUB_ENV
- - name: Set podspec Swift version to 6.0, if supported.
- if: inputs.supports_swift6 == true && matrix.os != 'macos-14'
- run: sed -i "" "s/s.swift_version[[:space:]]*=[[:space:]]*'5.9'/s.swift_version = '6.0'/" ${{ inputs.product }}.podspec
- - name: Run setup command, if needed.
- if: inputs.setup_command != ''
- env:
- plist_secret: ${{ secrets.plist_secret }}
- run: ${{ inputs.setup_command }}
- - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
- if: contains(join(inputs.platforms), matrix.platform) || matrix.os == 'macos-14'
- with:
- timeout_minutes: 120
- max_attempts: 3
- retry_on: error
- retry_wait_seconds: 120
- command: |
- scripts/pod_lib_lint.rb ${{ inputs.product }}.podspec --platforms=${{ matrix.platform }} \
- ${{ inputs.allow_warnings == true && '--allow-warnings' || '' }} \
- ${{ inputs.analyze == false && '--no-analyze' || '' }} \
- ${{ inputs.test_specs != '' && format('--test-specs={0}', inputs.test_specs) || '' }} \
- ${{ (contains(inputs.buildonly_platforms, matrix.platform) || contains(inputs.buildonly_platforms, 'all')) && '--skip-tests' || '' }}
|