action.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. name: 'Create MacOS package'
  2. inputs:
  3. profile: # emqx, emqx-enterprise
  4. required: true
  5. type: string
  6. otp: # 25.1.2-2, 24.3.4.2-2
  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. env:
  31. HOMEBREW_NO_AUTO_UPDATE: 1
  32. HOMEBREW_NO_INSTALL_UPGRADE: 1
  33. HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
  34. run: |
  35. brew update
  36. brew install curl zip unzip coreutils openssl@1.1
  37. echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
  38. echo "/usr/local/bin" >> $GITHUB_PATH
  39. echo "emqx_name=${emqx_name}" >> $GITHUB_OUTPUT
  40. OTP_SOURCE_PATH="$HOME/src/otp-${{ inputs.otp }}"
  41. OTP_INSTALL_PATH="$HOME/otp/${{ inputs.otp }}"
  42. echo "OTP_SOURCE_PATH=$OTP_SOURCE_PATH" >> $GITHUB_OUTPUT
  43. echo "OTP_INSTALL_PATH=$OTP_INSTALL_PATH" >> $GITHUB_OUTPUT
  44. mkdir -p "$OTP_SOURCE_PATH" "$OTP_INSTALL_PATH"
  45. - uses: actions/cache@v3
  46. id: cache
  47. with:
  48. path: ${{ steps.prepare.outputs.OTP_INSTALL_PATH }}
  49. key: otp-install-${{ inputs.otp }}-${{ inputs.os }}-static-ssl-disable-hipe-disable-jit
  50. - name: build erlang
  51. if: steps.cache.outputs.cache-hit != 'true'
  52. shell: bash
  53. run: |
  54. OTP_SOURCE_PATH="${{ steps.prepare.outputs.OTP_SOURCE_PATH }}"
  55. OTP_INSTALL_PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}"
  56. if [ -d "$OTP_SOURCE_PATH" ]; then
  57. rm -rf "$OTP_SOURCE_PATH"
  58. fi
  59. git clone --depth 1 --branch OTP-${{ inputs.otp }} https://github.com/emqx/otp.git "$OTP_SOURCE_PATH"
  60. cd "$OTP_SOURCE_PATH"
  61. if [ "$(arch)" = arm64 ]; then
  62. export LDFLAGS="-L$(brew --prefix unixodbc)/lib"
  63. export CC="/usr/bin/gcc -I$(brew --prefix unixodbc)/include"
  64. fi
  65. ./configure --disable-dynamic-ssl-lib --with-ssl=$(brew --prefix openssl@1.1) --disable-hipe --disable-jit --prefix="$OTP_INSTALL_PATH"
  66. make -j$(nproc)
  67. rm -rf "$OTP_INSTALL_PATH"
  68. make install
  69. if [ "$(arch)" = arm64 ]; then
  70. unset LDFLAGS
  71. unset CC
  72. fi
  73. - name: build
  74. env:
  75. HOMEBREW_NO_AUTO_UPDATE: 1
  76. HOMEBREW_NO_INSTALL_UPGRADE: 1
  77. HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
  78. AUTO_INSTALL_BUILD_DEPS: 1
  79. APPLE_SIGN_BINARIES: 1
  80. APPLE_ID: developers@emqx.io
  81. APPLE_TEAM_ID: 26N6HYJLZA
  82. APPLE_ID_PASSWORD: ${{ inputs.apple_id_password }}
  83. APPLE_DEVELOPER_IDENTITY: ${{ inputs.apple_developer_identity }}
  84. APPLE_DEVELOPER_ID_BUNDLE: ${{ inputs.apple_developer_id_bundle }}
  85. APPLE_DEVELOPER_ID_BUNDLE_PASSWORD: ${{ inputs.apple_developer_id_bundle_password }}
  86. shell: bash
  87. run: |
  88. export PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}/bin:$PATH"
  89. make ensure-rebar3
  90. mkdir -p $HOME/bin
  91. cp rebar3 $HOME/bin/rebar3
  92. export PATH="$HOME/bin:$PATH"
  93. make ${{ inputs.profile }}-tgz
  94. - name: test ${{ inputs.profile }}
  95. shell: bash
  96. run: |
  97. export PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}/bin:$PATH"
  98. pkg_name=$(find _packages/${{ inputs.profile }} -mindepth 1 -maxdepth 1 -iname \*.zip)
  99. mkdir emqx
  100. unzip -d emqx $pkg_name > /dev/null
  101. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  102. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  103. ready='no'
  104. for i in {1..30}; do
  105. if curl -fs 127.0.0.1:18083/status > /dev/null; then
  106. ready='yes'
  107. break
  108. fi
  109. sleep 1
  110. done
  111. if [ "$ready" != "yes" ]; then
  112. echo "Timed out waiting for emqx to be ready"
  113. cat emqx/log/erlang.log.1
  114. exit 1
  115. fi
  116. ./emqx/bin/emqx_ctl status
  117. ./emqx/bin/emqx stop
  118. rm -rf emqx