name: common_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/common_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 # Whether to test the legacy version of the quickstart. is_legacy: type: boolean required: true # 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 # The type of quickstart to test. # # Options: [swift, objc] quickstart_type: type: string required: false default: objc # 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: # 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.plist_secret }} LEGACY: ${{ inputs.is_legacy && true || '' }} 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. 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" - name: Build ${{ inputs.product }} Quickstart (${{ inputs.quickstart_type }} / ${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }}) uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 with: timeout_minutes: 15 max_attempts: 3 retry_wait_seconds: 120 command: | scripts/test_quickstart.sh \ ${{ inputs.product }} \ ${{ inputs.run_tests }} \ ${{ inputs.quickstart_type }} # Failure sequence to upload artifact. - id: lowercase_product if: ${{ failure() }} run: | lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]') echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT - name: Remove data before upload. if: ${{ failure() }} run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }} - uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }} path: quickstart-ios/