build_slim_packages.yaml 3.8 KB

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