Files
firebase-ios-sdk/.github/workflows/_quickstart.yml
T

130 lines
4.0 KiB
YAML

name: _quickstart
permissions:
contents: read
on:
workflow_call:
# Re-usable workflows do not automatically inherit the caller's secrets.
#
# This workflow decrypts encrypted files, so the calling workflow needs to
# pass the secret to the re-usable workflow.
#
# Example:
#
# quickstart:
# uses: ./.github/workflows/_quickstart.yml
# with:
# # ...
# secrets:
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
#
secrets:
plist_secret:
required: true
inputs:
# The product to test be tested (e.g. `ABTesting`).
product:
type: string
required: true
# The branch to checkout in the quickstart repo.
quickstart_branch:
type: string
required: false
default: 'main'
# The path to the encrypted `GoogleService-Info.plist` file.
plist_src_path:
type: string
required: true
# The destination path for the decrypted `GoogleService-Info.plist` file.
plist_dst_path:
type: string
required: true
# Whether to run tests or just build. Defaults to true.
run_tests:
type: boolean
required: false
default: true
# A command to execute before testing.
#
# Example: `scripts/setup_quickstart.sh functions`
setup_command:
type: string
required: false
default: ""
jobs:
quickstart:
name: quickstart (${{ inputs.product }})
if: |
github.repository == 'firebase/firebase-ios-sdk' &&
contains(fromJSON('["schedule", "pull_request", "workflow_dispatch"]'), github.event_name)
env:
plist_secret: ${{ secrets.plist_secret }}
QUICKSTART_BRANCH: ${{ inputs.quickstart_branch }}
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-26
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0
- name: Prereqs
run: gem install xcpretty
- name: Xcode
run: sudo xcode-select -s /Applications/Xcode_26.4.app/Contents/Developer
- name: Setup simulator
uses: ./.github/actions/setup_simulator
with:
platform: iOS
- name: Run setup command.
run: ${{ inputs.setup_command }} # zizmor: ignore[template-injection]
- name: Install Secret GoogleService-Info.plist
env:
PLIST_SRC_PATH: ${{ inputs.plist_src_path }}
PLIST_DST_PATH: ${{ inputs.plist_dst_path }}
run: |
scripts/decrypt_gha_secret.sh \
"$PLIST_SRC_PATH" \
"$PLIST_DST_PATH" \
"$plist_secret"
- name: Build ${{ inputs.product }} Quickstart
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
env:
PRODUCT: ${{ inputs.product }}
RUN_TESTS: ${{ inputs.run_tests }}
with:
timeout_minutes: 15
max_attempts: 3
retry_wait_seconds: 120
command: |
SPM=true DIR="$PRODUCT" scripts/test_quickstart.sh \
"$PRODUCT" \
"$RUN_TESTS"
# Failure sequence to upload artifact.
- id: lowercase_product
if: failure()
env:
PRODUCT: ${{ inputs.product }}
run: |
lowercase_product=$(echo "$PRODUCT" | tr '[:upper:]' '[:lower:]')
echo "lowercase_product=$lowercase_product" >> "$GITHUB_OUTPUT"
- name: Remove data before upload.
if: failure()
env:
LOWERCASE_PRODUCT: ${{ steps.lowercase_product.outputs.lowercase_product }}
run: scripts/remove_data.sh "$LOWERCASE_PRODUCT"
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: failure()
with:
name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }}
path: |
quickstart-ios/
!quickstart-ios/**/GoogleService-Info.plist