build_slim_packages.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. env:
  77. KERL_BUILD_BACKEND: git
  78. OTP_GITHUB_URL: https://github.com/emqx/otp
  79. run: |
  80. kerl update releases
  81. kerl build ${{ matrix.erl_otp }}
  82. kerl install ${{ matrix.erl_otp }} $HOME/.kerl/${{ matrix.erl_otp }}
  83. - name: build
  84. run: |
  85. . $HOME/.kerl/${{ matrix.erl_otp }}/activate
  86. make ensure-rebar3
  87. sudo cp rebar3 /usr/local/bin/rebar3
  88. make ${EMQX_NAME}-zip
  89. - name: test
  90. run: |
  91. pkg_name=$(basename _packages/${EMQX_NAME}/emqx-*.zip)
  92. unzip -q _packages/${EMQX_NAME}/$pkg_name
  93. gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  94. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  95. ready='no'
  96. for i in {1..10}; do
  97. if curl -fs 127.0.0.1:18083 > /dev/null; then
  98. ready='yes'
  99. break
  100. fi
  101. sleep 1
  102. done
  103. if [ "$ready" != "yes" ]; then
  104. echo "Timed out waiting for emqx to be ready"
  105. cat emqx/log/erlang.log.1
  106. exit 1
  107. fi
  108. ./emqx/bin/emqx_ctl status
  109. ./emqx/bin/emqx stop
  110. rm -rf emqx
  111. - uses: actions/upload-artifact@v2
  112. with:
  113. name: macos
  114. path: _packages/**/*.zip