build_slim_packages.yaml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. branches:
  8. - master
  9. pull_request:
  10. # GitHub pull_request action is by default triggered when
  11. # opened reopened or synchronize,
  12. # we add labeled and unlabeled to the list because
  13. # the mac job dpends on the PR having a 'Mac' label
  14. types:
  15. - labeled
  16. - unlabeled
  17. - opened
  18. - reopened
  19. - synchronize
  20. workflow_dispatch:
  21. jobs:
  22. linux:
  23. runs-on: ubuntu-20.04
  24. strategy:
  25. fail-fast: false
  26. matrix:
  27. profile:
  28. - emqx-edge
  29. - emqx
  30. - emqx-enterprise
  31. otp:
  32. - 24.2.1-1
  33. elixir:
  34. - 1.13.3
  35. os:
  36. - ubuntu20.04
  37. - rockylinux8
  38. container: "ghcr.io/emqx/emqx-builder/5.0-8:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  39. steps:
  40. - uses: actions/checkout@v1
  41. - name: prepare
  42. run: |
  43. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  44. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $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: |
  54. _build/default/lib/rocksdb/
  55. deps/rocksdb/
  56. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  57. - name: load quicer cache
  58. uses: actions/cache@v2
  59. with:
  60. path: |
  61. _build/default/lib/quicer/
  62. deps/quicer/
  63. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  64. - name: build and test tgz package
  65. run: |
  66. make ${EMQX_NAME}-tgz
  67. ./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
  68. - name: run static checks
  69. if: contains(matrix.os, 'ubuntu')
  70. run: |
  71. make static_checks
  72. - name: build and test deb/rpm packages
  73. run: |
  74. make ${EMQX_NAME}-pkg
  75. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  76. - name: build and test tgz package (Elixir)
  77. run: |
  78. make ${EMQX_NAME}-elixir-tgz
  79. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-tgz
  80. - name: build and test deb/rpm packages (Elixir)
  81. run: |
  82. make ${EMQX_NAME}-elixir-pkg
  83. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-pkg
  84. - uses: actions/upload-artifact@v2
  85. with:
  86. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  87. path: _packages/${{ matrix.profile}}/*.tar.gz
  88. windows:
  89. runs-on: windows-2019
  90. strategy:
  91. fail-fast: false
  92. matrix:
  93. profile:
  94. - emqx
  95. otp:
  96. - 24.2.1
  97. steps:
  98. - uses: actions/checkout@v2
  99. - uses: ilammy/msvc-dev-cmd@v1
  100. - uses: erlef/setup-beam@v1
  101. with:
  102. otp-version: ${{ matrix.otp }}
  103. - name: build
  104. env:
  105. PYTHON: python
  106. DIAGNOSTIC: 1
  107. run: |
  108. # ensure crypto app (openssl)
  109. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  110. make ${{ matrix.profile }}-tgz
  111. - name: run emqx
  112. timeout-minutes: 5
  113. run: |
  114. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  115. Start-Sleep -s 5
  116. echo "EMQX started"
  117. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  118. echo "EMQX stopped"
  119. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  120. echo "EMQX installed"
  121. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  122. echo "EMQX uninstalled"
  123. mac:
  124. strategy:
  125. fail-fast: false
  126. matrix:
  127. profile:
  128. - emqx
  129. - emqx-enterprise
  130. otp:
  131. - 24.2.1-1
  132. macos:
  133. - macos-11
  134. - macos-10.15
  135. runs-on: ${{ matrix.macos }}
  136. steps:
  137. - uses: actions/checkout@v2
  138. - name: prepare
  139. run: |
  140. brew update
  141. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  142. echo "/usr/local/bin" >> $GITHUB_PATH
  143. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  144. - uses: actions/cache@v2
  145. id: cache
  146. with:
  147. path: ~/.kerl/${{ matrix.otp }}
  148. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  149. - name: build erlang
  150. if: steps.cache.outputs.cache-hit != 'true'
  151. timeout-minutes: 60
  152. env:
  153. KERL_BUILD_BACKEND: git
  154. OTP_GITHUB_URL: https://github.com/emqx/otp
  155. run: |
  156. kerl update releases
  157. kerl build ${{ matrix.otp }}
  158. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  159. - name: Get deps git refs for cache
  160. id: deps-refs
  161. run: |
  162. . $HOME/.kerl/${{ matrix.otp }}/activate
  163. make ensure-rebar3
  164. sudo cp rebar3 /usr/local/bin/rebar3
  165. scripts/get-dep-refs.sh
  166. make clean-all
  167. - name: load rocksdb cache
  168. uses: actions/cache@v2
  169. with:
  170. path: _build/default/lib/rocksdb/
  171. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  172. - name: load quicer cache
  173. uses: actions/cache@v2
  174. with:
  175. path: _build/default/lib/quicer/
  176. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  177. - name: build ${{ matrix.profile }}
  178. run: |
  179. . $HOME/.kerl/${{ matrix.otp }}/activate
  180. make ensure-rebar3
  181. sudo cp rebar3 /usr/local/bin/rebar3
  182. make ${{ matrix.profile }}-tgz
  183. - name: test
  184. run: |
  185. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  186. tar -zxf $pkg_name
  187. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  188. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  189. ready='no'
  190. for i in {1..10}; do
  191. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  192. ready='yes'
  193. break
  194. fi
  195. sleep 1
  196. done
  197. if [ "$ready" != "yes" ]; then
  198. echo "Timed out waiting for emqx to be ready"
  199. cat emqx/log/erlang.log.1
  200. exit 1
  201. fi
  202. ./emqx/bin/emqx_ctl status
  203. ./emqx/bin/emqx stop
  204. rm -rf emqx
  205. - uses: actions/upload-artifact@v2
  206. with:
  207. name: macos
  208. path: _packages/**/*.tar.gz