build_slim_packages.yaml 3.6 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. runs-on: macos-10.15
  51. strategy:
  52. matrix:
  53. erl_otp:
  54. - 23.2.7.2-emqx-3
  55. steps:
  56. - uses: actions/checkout@v1
  57. - name: prepare
  58. run: |
  59. if make emqx-ee --dry-run > /dev/null 2>&1; then
  60. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  61. git config --global credential.helper store
  62. echo "${{ secrets.CI_GIT_TOKEN }}" >> ./scripts/git-token
  63. echo "EMQX_NAME=emqx-ee" >> $GITHUB_ENV
  64. else
  65. echo "EMQX_NAME=emqx" >> $GITHUB_ENV
  66. fi
  67. - name: prepare
  68. run: |
  69. brew update
  70. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  71. echo "/usr/local/bin" >> $GITHUB_PATH
  72. git config --global credential.helper store
  73. - uses: actions/cache@v2
  74. id: cache
  75. with:
  76. path: ~/.kerl
  77. key: erl${{ matrix.erl_otp }}-macos10.15
  78. - name: build erlang
  79. if: steps.cache.outputs.cache-hit != 'true'
  80. timeout-minutes: 60
  81. env:
  82. KERL_BUILD_BACKEND: git
  83. OTP_GITHUB_URL: https://github.com/emqx/otp
  84. run: |
  85. kerl update releases
  86. kerl build ${{ matrix.erl_otp }}
  87. kerl install ${{ matrix.erl_otp }} $HOME/.kerl/${{ matrix.erl_otp }}
  88. - name: build
  89. run: |
  90. . $HOME/.kerl/${{ matrix.erl_otp }}/activate
  91. make ensure-rebar3
  92. sudo cp rebar3 /usr/local/bin/rebar3
  93. make ${EMQX_NAME}-zip
  94. - uses: actions/upload-artifact@v1
  95. if: failure()
  96. with:
  97. name: rebar3.crashdump
  98. path: ./rebar3.crashdump
  99. - name: test
  100. run: |
  101. pkg_name=$(basename _packages/${EMQX_NAME}/emqx-*.zip)
  102. unzip -q _packages/${EMQX_NAME}/$pkg_name
  103. gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  104. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  105. ready='no'
  106. for i in {1..10}; do
  107. if curl -fs 127.0.0.1:18083 > /dev/null; then
  108. ready='yes'
  109. break
  110. fi
  111. sleep 1
  112. done
  113. if [ "$ready" != "yes" ]; then
  114. echo "Timed out waiting for emqx to be ready"
  115. cat emqx/log/erlang.log.1
  116. exit 1
  117. fi
  118. ./emqx/bin/emqx_ctl status
  119. ./emqx/bin/emqx stop
  120. rm -rf emqx
  121. - uses: actions/upload-artifact@v2
  122. with:
  123. name: macos
  124. path: _packages/**/*.zip