build_slim_packages.yaml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. # GitHub pull_request action is by default triggered when
  12. # opened reopened or synchronize,
  13. # we add labeled and unlabeled to the list because
  14. # the mac job dpends on the PR having a 'Mac' label
  15. types:
  16. - labeled
  17. - unlabeled
  18. - opened
  19. - reopened
  20. - synchronize
  21. workflow_dispatch:
  22. jobs:
  23. linux:
  24. runs-on: ubuntu-20.04
  25. strategy:
  26. fail-fast: false
  27. matrix:
  28. profile:
  29. - emqx-edge
  30. - emqx
  31. - emqx-enterprise
  32. otp:
  33. - 24.1.5-3
  34. os:
  35. - ubuntu20.04
  36. - centos7
  37. container: "ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}"
  38. steps:
  39. - uses: actions/checkout@v1
  40. - name: prepare
  41. run: |
  42. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  43. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  44. echo "EMQX_PKG_NAME=${{ matrix.profile }}-$(./pkg-vsn.sh)-otp${{ matrix.otp }}-${{ matrix.os }}-amd64" >> $GITHUB_ENV
  45. - name: Get deps git refs for cache
  46. id: deps-refs
  47. run: |
  48. scripts/get-dep-refs.sh
  49. make clean-all
  50. - name: load rocksdb cache
  51. uses: actions/cache@v2
  52. with:
  53. path: _build/default/lib/rocksdb/
  54. key: ${{ matrix.os }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  55. - name: load quicer cache
  56. uses: actions/cache@v2
  57. with:
  58. path: _build/default/lib/quicer/
  59. key: ${{ matrix.os }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  60. - name: build and test tgz package
  61. run: |
  62. make ${EMQX_NAME}-tgz
  63. .ci/build_packages/tests.sh "$EMQX_PKG_NAME" tgz
  64. - name: run static checks
  65. if: contains(matrix.os, 'ubuntu')
  66. run: |
  67. make static_checks
  68. - name: build and test deb/rpm packages
  69. run: |
  70. make ${EMQX_NAME}-pkg
  71. .ci/build_packages/tests.sh "$EMQX_PKG_NAME" pkg
  72. - uses: actions/upload-artifact@v2
  73. with:
  74. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  75. path: _packages/${{ matrix.profile}}/*.tar.gz
  76. mac:
  77. strategy:
  78. fail-fast: false
  79. matrix:
  80. profile:
  81. - emqx
  82. - emqx-enterprise
  83. otp:
  84. - 24.1.5-3
  85. macos:
  86. - macos-11
  87. - macos-10.15
  88. runs-on: ${{ matrix.macos }}
  89. steps:
  90. - uses: actions/checkout@v2
  91. - name: prepare
  92. run: |
  93. brew update
  94. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  95. echo "/usr/local/bin" >> $GITHUB_PATH
  96. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  97. - uses: actions/cache@v2
  98. id: cache
  99. with:
  100. path: ~/.kerl/${{ matrix.otp }}
  101. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  102. - name: build erlang
  103. if: steps.cache.outputs.cache-hit != 'true'
  104. timeout-minutes: 60
  105. env:
  106. KERL_BUILD_BACKEND: git
  107. OTP_GITHUB_URL: https://github.com/emqx/otp
  108. run: |
  109. kerl update releases
  110. kerl build ${{ matrix.otp }}
  111. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  112. - name: Get deps git refs for cache
  113. id: deps-refs
  114. run: |
  115. . $HOME/.kerl/${{ matrix.otp }}/activate
  116. make ensure-rebar3
  117. sudo cp rebar3 /usr/local/bin/rebar3
  118. scripts/get-dep-refs.sh
  119. make clean-all
  120. - name: load rocksdb cache
  121. uses: actions/cache@v2
  122. with:
  123. path: _build/default/lib/rocksdb/
  124. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  125. - name: load quicer cache
  126. uses: actions/cache@v2
  127. with:
  128. path: _build/default/lib/quicer/
  129. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  130. - name: build ${{ matrix.profile }}
  131. run: |
  132. . $HOME/.kerl/${{ matrix.otp }}/activate
  133. make ensure-rebar3
  134. sudo cp rebar3 /usr/local/bin/rebar3
  135. make ${{ matrix.profile }}-tgz
  136. - name: test
  137. run: |
  138. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  139. tar -zxf $pkg_name
  140. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  141. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  142. ready='no'
  143. for i in {1..10}; do
  144. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  145. ready='yes'
  146. break
  147. fi
  148. sleep 1
  149. done
  150. if [ "$ready" != "yes" ]; then
  151. echo "Timed out waiting for emqx to be ready"
  152. cat emqx/log/erlang.log.1
  153. exit 1
  154. fi
  155. ./emqx/bin/emqx_ctl status
  156. ./emqx/bin/emqx stop
  157. rm -rf emqx
  158. - uses: actions/upload-artifact@v2
  159. with:
  160. name: macos
  161. path: _packages/**/*.tar.gz