build_slim_packages.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: Build slim packages
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. - e*
  7. pull_request:
  8. workflow_dispatch:
  9. jobs:
  10. build:
  11. runs-on: ubuntu-20.04
  12. strategy:
  13. matrix:
  14. erl_otp:
  15. - erl23.2.7.2-emqx-3
  16. os:
  17. - ubuntu20.04
  18. - centos7
  19. container: emqx/build-env:${{ matrix.erl_otp }}-${{ matrix.os }}
  20. steps:
  21. - uses: actions/checkout@v1
  22. - name: prepare
  23. run: |
  24. if make emqx-ee --dry-run > /dev/null 2>&1; then
  25. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  26. git config --global credential.helper store
  27. echo "${{ secrets.CI_GIT_TOKEN }}" >> ./scripts/git-token
  28. echo "EMQX_NAME=emqx-ee" >> $GITHUB_ENV
  29. else
  30. echo "EMQX_NAME=emqx" >> $GITHUB_ENV
  31. fi
  32. - name: build zip packages
  33. run: make ${EMQX_NAME}-zip
  34. - name: build deb/rpm packages
  35. run: make ${EMQX_NAME}-pkg
  36. - uses: actions/upload-artifact@v1
  37. if: failure()
  38. with:
  39. name: rebar3.crashdump
  40. path: ./rebar3.crashdump
  41. - name: pakcages test
  42. run: |
  43. export CODE_PATH=$GITHUB_WORKSPACE
  44. .ci/build_packages/tests.sh
  45. - uses: actions/upload-artifact@v2
  46. with:
  47. name: ${{ matrix.os }}
  48. path: _packages/**/*.zip
  49. mac:
  50. strategy:
  51. matrix:
  52. erl_otp:
  53. - 23.2.7.2-emqx-3
  54. macos:
  55. - macos-11
  56. runs-on: ${{ matrix.macos }}
  57. steps:
  58. - uses: actions/checkout@v1
  59. - name: prepare
  60. run: |
  61. if make emqx-ee --dry-run > /dev/null 2>&1; then
  62. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  63. git config --global credential.helper store
  64. echo "${{ secrets.CI_GIT_TOKEN }}" >> ./scripts/git-token
  65. echo "EMQX_NAME=emqx-ee" >> $GITHUB_ENV
  66. else
  67. echo "EMQX_NAME=emqx" >> $GITHUB_ENV
  68. fi
  69. - name: prepare
  70. run: |
  71. brew update
  72. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  73. echo "/usr/local/bin" >> $GITHUB_PATH
  74. git config --global credential.helper store
  75. - uses: actions/cache@v2
  76. id: cache
  77. with:
  78. path: ~/.kerl/${{ matrix.erl_otp }}
  79. key: otp-install-${{ matrix.erl_otp }}-${{ matrix.macos }}
  80. - name: build erlang
  81. if: steps.cache.outputs.cache-hit != 'true'
  82. timeout-minutes: 60
  83. env:
  84. KERL_BUILD_BACKEND: git
  85. OTP_GITHUB_URL: https://github.com/emqx/otp
  86. run: |
  87. kerl update releases
  88. kerl build ${{ matrix.erl_otp }}
  89. kerl install ${{ matrix.erl_otp }} $HOME/.kerl/${{ matrix.erl_otp }}
  90. - name: build
  91. run: |
  92. . $HOME/.kerl/${{ matrix.erl_otp }}/activate
  93. make ensure-rebar3
  94. sudo cp rebar3 /usr/local/bin/rebar3
  95. make ${EMQX_NAME}-zip
  96. - uses: actions/upload-artifact@v1
  97. if: failure()
  98. with:
  99. name: rebar3.crashdump
  100. path: ./rebar3.crashdump
  101. - name: test
  102. run: |
  103. pkg_name=$(basename _packages/${EMQX_NAME}/emqx-*.zip)
  104. unzip -q _packages/${EMQX_NAME}/$pkg_name
  105. gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  106. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  107. ready='no'
  108. for i in {1..10}; do
  109. if curl -fs 127.0.0.1:18083 > /dev/null; then
  110. ready='yes'
  111. break
  112. fi
  113. sleep 1
  114. done
  115. if [ "$ready" != "yes" ]; then
  116. echo "Timed out waiting for emqx to be ready"
  117. cat emqx/log/erlang.log.1
  118. exit 1
  119. fi
  120. ./emqx/bin/emqx_ctl status
  121. ./emqx/bin/emqx stop
  122. rm -rf emqx
  123. - uses: actions/upload-artifact@v2
  124. with:
  125. name: macos
  126. path: _packages/**/*.zip