action.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. name: 'Create MacOS package'
  2. inputs:
  3. profile: # emqx, emqx-enterprise
  4. required: true
  5. type: string
  6. otp: # 24.2.1-1, 23.3.4.9-3
  7. required: true
  8. type: string
  9. os:
  10. required: false
  11. type: string
  12. default: macos-11
  13. apple_id_password:
  14. required: true
  15. type: string
  16. apple_developer_identity:
  17. required: true
  18. type: string
  19. apple_developer_id_bundle:
  20. required: true
  21. type: string
  22. apple_developer_id_bundle_password:
  23. required: true
  24. type: string
  25. runs:
  26. using: composite
  27. steps:
  28. - id: prepare
  29. shell: bash
  30. run: |
  31. brew update
  32. brew install curl zip unzip coreutils openssl@1.1
  33. echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
  34. echo "/usr/local/bin" >> $GITHUB_PATH
  35. echo "emqx_name=${emqx_name}" >> $GITHUB_OUTPUT
  36. OTP_SOURCE_PATH="$HOME/src/otp-${{ inputs.otp }}"
  37. OTP_INSTALL_PATH="$HOME/otp/${{ inputs.otp }}"
  38. echo "OTP_SOURCE_PATH=$OTP_SOURCE_PATH" >> $GITHUB_OUTPUT
  39. echo "OTP_INSTALL_PATH=$OTP_INSTALL_PATH" >> $GITHUB_OUTPUT
  40. mkdir -p "$OTP_SOURCE_PATH" "$OTP_INSTALL_PATH"
  41. - uses: actions/cache@v3
  42. id: cache
  43. with:
  44. path: ${{ steps.prepare.outputs.OTP_INSTALL_PATH }}
  45. key: otp-install-${{ inputs.otp }}-${{ inputs.os }}-static-ssl-disable-hipe-disable-jit
  46. - name: build erlang
  47. if: steps.cache.outputs.cache-hit != 'true'
  48. shell: bash
  49. run: |
  50. OTP_SOURCE_PATH="${{ steps.prepare.outputs.OTP_SOURCE_PATH }}"
  51. OTP_INSTALL_PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}"
  52. if [ -d "$OTP_SOURCE_PATH" ]; then
  53. rm -rf "$OTP_SOURCE_PATH"
  54. fi
  55. git clone --depth 1 --branch OTP-${{ inputs.otp }} https://github.com/emqx/otp.git "$OTP_SOURCE_PATH"
  56. cd "$OTP_SOURCE_PATH"
  57. ./configure --disable-dynamic-ssl-lib --with-ssl=$(brew --prefix openssl@1.1) --disable-hipe --disable-jit --prefix="$OTP_INSTALL_PATH"
  58. make -j$(nproc)
  59. rm -rf "$OTP_INSTALL_PATH"
  60. make install
  61. - name: build ${{ inputs.profile }}
  62. env:
  63. AUTO_INSTALL_BUILD_DEPS: 1
  64. APPLE_SIGN_BINARIES: 1
  65. APPLE_ID: developers@emqx.io
  66. APPLE_TEAM_ID: 26N6HYJLZA
  67. APPLE_ID_PASSWORD: ${{ inputs.apple_id_password }}
  68. APPLE_DEVELOPER_IDENTITY: ${{ inputs.apple_developer_identity }}
  69. APPLE_DEVELOPER_ID_BUNDLE: ${{ inputs.apple_developer_id_bundle }}
  70. APPLE_DEVELOPER_ID_BUNDLE_PASSWORD: ${{ inputs.apple_developer_id_bundle_password }}
  71. shell: bash
  72. run: |
  73. export PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}/bin:$PATH"
  74. make ensure-rebar3
  75. mkdir -p $HOME/bin
  76. cp rebar3 $HOME/bin/rebar3
  77. export PATH="$HOME/bin:$PATH"
  78. make ${{ inputs.profile }}-tgz
  79. - name: test ${{ inputs.profile }}
  80. shell: bash
  81. run: |
  82. export PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}/bin:$PATH"
  83. pkg_name=$(find _packages/${{ inputs.profile }} -mindepth 1 -maxdepth 1 -iname \*.zip)
  84. mkdir emqx
  85. unzip -d emqx $pkg_name > /dev/null
  86. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  87. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  88. ready='no'
  89. for i in {1..30}; do
  90. if curl -fs 127.0.0.1:18083/status > /dev/null; then
  91. ready='yes'
  92. break
  93. fi
  94. sleep 1
  95. done
  96. if [ "$ready" != "yes" ]; then
  97. echo "Timed out waiting for emqx to be ready"
  98. cat emqx/log/erlang.log.1
  99. exit 1
  100. fi
  101. ./emqx/bin/emqx_ctl status
  102. ./emqx/bin/emqx stop
  103. rm -rf emqx