Skip to content

refactor(ci): Introduce common, re-usable quickstart workflow #1

refactor(ci): Introduce common, re-usable quickstart workflow

refactor(ci): Introduce common, re-usable quickstart workflow #1

name: common_cocoapods

Check failure on line 1 in .github/workflows/common_quickstart.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/common_quickstart.yml

Invalid workflow file

(Line: 30, Col: 1): 'name' is already defined, (Line: 32, Col: 1): 'permissions' is already defined, (Line: 35, Col: 1): 'on' is already defined
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: true
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
is_legacy:
type: boolean
required: false
default: false
plist_src_path:
type: string
required: true
plist_dst_path:
type: string
required: true
# 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:
quickstart:
# 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)
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
- name: Xcode
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- name: Run setup command.
env:
LEGACY: inputs.is_legacy == true
run: ${{ inputs.setup_command }}
- name: Install Secret GoogleService-Info.plist
run: |
scripts/decrypt_gha_secret.sh \
${{ inputs.plist_src_path }} \
${{ inputs.plist_dst_path }} \
"$plist_secret"
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
env:
LEGACY: ${{ inputs.is_legacy == true }}
with:
timeout_minutes: 15
max_attempts: 3
retry_wait_seconds: 120
command: |
([ -z $plist_secret ] || == true && 'LEGACY=true' || '' }} scripts/test_quickstart.sh ${{ inputs.product }} true)