build_slim_packages.yaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 quicer cache
  51. uses: actions/cache@v2
  52. with:
  53. path: |
  54. _build/default/lib/quicer/
  55. deps/quicer/
  56. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  57. - name: build and test tgz package
  58. run: |
  59. make ${EMQX_NAME}-tgz
  60. ./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
  61. - name: run static checks
  62. if: contains(matrix.os, 'ubuntu')
  63. run: |
  64. make static_checks
  65. - name: build and test deb/rpm packages
  66. run: |
  67. make ${EMQX_NAME}-pkg
  68. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  69. - name: build and test tgz package (Elixir)
  70. run: |
  71. make ${EMQX_NAME}-elixir-tgz
  72. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-tgz
  73. - name: build and test deb/rpm packages (Elixir)
  74. run: |
  75. make ${EMQX_NAME}-elixir-pkg
  76. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-pkg
  77. - uses: actions/upload-artifact@v2
  78. with:
  79. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  80. path: _packages/${{ matrix.profile}}/*.tar.gz
  81. windows:
  82. runs-on: windows-2019
  83. strategy:
  84. fail-fast: false
  85. matrix:
  86. profile:
  87. - emqx
  88. otp:
  89. - 24.2.1
  90. steps:
  91. - uses: actions/checkout@v2
  92. - uses: ilammy/msvc-dev-cmd@v1
  93. - uses: erlef/setup-beam@v1
  94. with:
  95. otp-version: ${{ matrix.otp }}
  96. - name: build
  97. env:
  98. PYTHON: python
  99. DIAGNOSTIC: 1
  100. run: |
  101. # ensure crypto app (openssl)
  102. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  103. make ${{ matrix.profile }}-tgz
  104. - name: run emqx
  105. timeout-minutes: 5
  106. run: |
  107. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  108. Start-Sleep -s 5
  109. echo "EMQX started"
  110. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  111. echo "EMQX stopped"
  112. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  113. echo "EMQX installed"
  114. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  115. echo "EMQX uninstalled"
  116. mac:
  117. strategy:
  118. fail-fast: false
  119. matrix:
  120. profile:
  121. - emqx
  122. - emqx-enterprise
  123. otp:
  124. - 24.2.1-1
  125. macos:
  126. - macos-11
  127. - macos-10.15
  128. runs-on: ${{ matrix.macos }}
  129. steps:
  130. - uses: actions/checkout@v2
  131. - name: prepare
  132. run: |
  133. brew update
  134. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  135. echo "/usr/local/bin" >> $GITHUB_PATH
  136. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  137. - uses: actions/cache@v2
  138. id: cache
  139. with:
  140. path: ~/.kerl/${{ matrix.otp }}
  141. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  142. - name: build erlang
  143. if: steps.cache.outputs.cache-hit != 'true'
  144. timeout-minutes: 60
  145. env:
  146. KERL_BUILD_BACKEND: git
  147. OTP_GITHUB_URL: https://github.com/emqx/otp
  148. run: |
  149. kerl update releases
  150. kerl build ${{ matrix.otp }}
  151. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  152. - name: Get deps git refs for cache
  153. id: deps-refs
  154. run: |
  155. . $HOME/.kerl/${{ matrix.otp }}/activate
  156. make ensure-rebar3
  157. sudo cp rebar3 /usr/local/bin/rebar3
  158. scripts/get-dep-refs.sh
  159. make clean-all
  160. - name: load quicer cache
  161. uses: actions/cache@v2
  162. with:
  163. path: _build/default/lib/quicer/
  164. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  165. - name: build ${{ matrix.profile }}
  166. run: |
  167. . $HOME/.kerl/${{ matrix.otp }}/activate
  168. make ensure-rebar3
  169. sudo cp rebar3 /usr/local/bin/rebar3
  170. make ${{ matrix.profile }}-tgz
  171. - name: test
  172. run: |
  173. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  174. tar -zxf $pkg_name
  175. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  176. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  177. ready='no'
  178. for i in {1..10}; do
  179. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  180. ready='yes'
  181. break
  182. fi
  183. sleep 1
  184. done
  185. if [ "$ready" != "yes" ]; then
  186. echo "Timed out waiting for emqx to be ready"
  187. cat emqx/log/erlang.log.1
  188. exit 1
  189. fi
  190. ./emqx/bin/emqx_ctl status
  191. ./emqx/bin/emqx stop
  192. rm -rf emqx
  193. - uses: actions/upload-artifact@v2
  194. with:
  195. name: macos
  196. path: _packages/**/*.tar.gz