build_slim_packages.yaml 6.6 KB

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