common_quickstart.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. # The branch to checkout in the quickstart repo.
  29. quickstart_branch:
  30. type: string
  31. required: false
  32. # default: 'main' # TODO: Revert to main before merging.
  33. default: 'nc/quickstarts'
  34. # The path to the encrypted `GoogleService-Info.plist` file.
  35. plist_src_path:
  36. type: string
  37. required: true
  38. # The destination path for the decrypted `GoogleService-Info.plist` file.
  39. plist_dst_path:
  40. type: string
  41. required: true
  42. # Whether to run tests or just build. Defaults to true.
  43. run_tests:
  44. type: boolean
  45. required: false
  46. default: true
  47. # A command to execute before testing.
  48. #
  49. # Example: `scripts/setup_quickstart.sh functions`
  50. setup_command:
  51. type: string
  52. required: false
  53. default: ""
  54. jobs:
  55. quickstart:
  56. name: quickstart (${{ inputs.product }})
  57. # Run on the main repo's scheduled jobs or pull requests and manual workflow invocations.
  58. if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name)
  59. env:
  60. plist_secret: ${{ secrets.plist_secret }}
  61. QUICKSTART_BRANCH: ${{ inputs.quickstart_branch }}
  62. runs-on: macos-15
  63. steps:
  64. - uses: actions/checkout@v4
  65. - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
  66. - name: Prereqs
  67. run: gem install xcpretty
  68. - name: Xcode
  69. run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
  70. - name: Run setup command.
  71. run: ${{ inputs.setup_command }}
  72. - name: Install Secret GoogleService-Info.plist
  73. run: |
  74. scripts/decrypt_gha_secret.sh \
  75. ${{ inputs.plist_src_path }} \
  76. ${{ inputs.plist_dst_path }} \
  77. "$plist_secret"
  78. - name: Build ${{ inputs.product }} Quickstart
  79. uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
  80. with:
  81. timeout_minutes: 15
  82. max_attempts: 3
  83. retry_wait_seconds: 120
  84. command: |
  85. SPM=true DIR=${{ inputs.product }} scripts/test_quickstart.sh \
  86. ${{ inputs.product }} \
  87. ${{ inputs.run_tests }}
  88. # Failure sequence to upload artifact.
  89. - id: lowercase_product
  90. if: ${{ failure() }}
  91. run: |
  92. lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]')
  93. echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT
  94. - name: Remove data before upload.
  95. if: ${{ failure() }}
  96. run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }}
  97. # - uses: actions/upload-artifact@v4
  98. # if: ${{ failure() }}
  99. # with:
  100. # name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }}
  101. # path: quickstart-ios/