build_slim_packages.yaml 3.3 KB

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