common_quickstart.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. name: common_quickstart
  2. permissions:
  3. contents: read
  4. on:
  5. workflow_call:
  6. # Re-usable workflows do not automatically inherit the caller's secrets.
  7. #
  8. # This workflow decrypts encrypted files, so the calling workflow needs to
  9. # pass the secret to the re-usable workflow.
  10. #
  11. # Example:
  12. #
  13. # quickstart:
  14. # uses: ./.github/workflows/common_quickstart.yml
  15. # with:
  16. # # ...
  17. # secrets:
  18. # plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
  19. #
  20. secrets:
  21. plist_secret:
  22. required: true
  23. inputs:
  24. # The product to test be tested (e.g. `ABTesting`).
  25. product:
  26. type: string
  27. required: true
  28. # Whether to test the legacy version of the quickstart.
  29. is_legacy:
  30. type: boolean
  31. required: true
  32. # The path to the encrypted `GoogleService-Info.plist` file.
  33. plist_src_path:
  34. type: string
  35. required: true
  36. # The destination path for the decrypted `GoogleService-Info.plist` file.
  37. plist_dst_path:
  38. type: string
  39. required: true
  40. # The type of quickstart to test.
  41. #
  42. # Options: [swift, objc]
  43. quickstart_type:
  44. type: string
  45. required: false
  46. default: objc
  47. # Whether to run tests or just build. Defaults to true.
  48. run_tests:
  49. type: boolean
  50. required: false
  51. default: true
  52. # A command to execute before testing.
  53. #
  54. # Example: `scripts/setup_quickstart.sh functions`
  55. setup_command:
  56. type: string
  57. required: false
  58. default: ""
  59. jobs:
  60. quickstart:
  61. # Run on the main repo's scheduled jobs or pull requests and manual workflow invocations.
  62. if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name)
  63. env:
  64. plist_secret: ${{ secrets.plist_secret }}
  65. LEGACY: ${{ inputs.is_legacy && true || '' }}
  66. runs-on: macos-15
  67. steps:
  68. - uses: actions/checkout@v4
  69. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  70. - name: Xcode
  71. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  72. - name: Run setup command.
  73. run: ${{ inputs.setup_command }}
  74. - name: Install Secret GoogleService-Info.plist
  75. run: |
  76. scripts/decrypt_gha_secret.sh \
  77. ${{ inputs.plist_src_path }} \
  78. ${{ inputs.plist_dst_path }} \
  79. "$plist_secret"
  80. - name: Build ${{ inputs.product }} Quickstart (${{ inputs.quickstart_type }} / ${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }})
  81. uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  82. with:
  83. timeout_minutes: 15
  84. max_attempts: 3
  85. retry_wait_seconds: 120
  86. command: |
  87. scripts/test_quickstart.sh \
  88. ${{ inputs.product }} \
  89. ${{ inputs.run_tests }} \
  90. ${{ inputs.quickstart_type }}
  91. # Failure sequence to upload artifact.
  92. - id: lowercase_product
  93. if: ${{ failure() }}
  94. run: |
  95. lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]')
  96. echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT
  97. - name: Remove data before upload.
  98. if: ${{ failure() }}
  99. run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }}
  100. - uses: actions/upload-artifact@v4
  101. if: ${{ failure() }}
  102. with:
  103. name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }}
  104. path: quickstart-ios/