build_slim_packages.yaml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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-10:${{ 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. - uses: actions/upload-artifact@v2
  82. with:
  83. name: "${{ matrix.profile }}_schema_dump"
  84. path: _build/*/lib/emqx_dashboard/priv/www/static/schema.json
  85. windows:
  86. runs-on: windows-2019
  87. strategy:
  88. fail-fast: false
  89. matrix:
  90. profile:
  91. - emqx
  92. otp:
  93. - 24.2.1
  94. steps:
  95. - uses: actions/checkout@v2
  96. - uses: ilammy/msvc-dev-cmd@v1
  97. - uses: erlef/setup-beam@v1
  98. with:
  99. otp-version: ${{ matrix.otp }}
  100. - name: build
  101. env:
  102. PYTHON: python
  103. DIAGNOSTIC: 1
  104. run: |
  105. # ensure crypto app (openssl)
  106. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  107. make ${{ matrix.profile }}-tgz
  108. - name: run emqx
  109. timeout-minutes: 5
  110. run: |
  111. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  112. Start-Sleep -s 5
  113. echo "EMQX started"
  114. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  115. echo "EMQX stopped"
  116. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  117. echo "EMQX installed"
  118. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  119. echo "EMQX uninstalled"
  120. mac:
  121. strategy:
  122. fail-fast: false
  123. matrix:
  124. profile:
  125. - emqx
  126. - emqx-enterprise
  127. otp:
  128. - 24.2.1-1
  129. macos:
  130. - macos-11
  131. - macos-10.15
  132. runs-on: ${{ matrix.macos }}
  133. steps:
  134. - uses: actions/checkout@v2
  135. - name: prepare
  136. run: |
  137. brew update
  138. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  139. echo "/usr/local/bin" >> $GITHUB_PATH
  140. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  141. - uses: actions/cache@v2
  142. id: cache
  143. with:
  144. path: ~/.kerl/${{ matrix.otp }}
  145. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  146. - name: build erlang
  147. if: steps.cache.outputs.cache-hit != 'true'
  148. timeout-minutes: 60
  149. env:
  150. KERL_BUILD_BACKEND: git
  151. OTP_GITHUB_URL: https://github.com/emqx/otp
  152. run: |
  153. kerl update releases
  154. kerl build ${{ matrix.otp }}
  155. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  156. - name: Get deps git refs for cache
  157. id: deps-refs
  158. run: |
  159. . $HOME/.kerl/${{ matrix.otp }}/activate
  160. make ensure-rebar3
  161. sudo cp rebar3 /usr/local/bin/rebar3
  162. scripts/get-dep-refs.sh
  163. make clean-all
  164. - name: load quicer cache
  165. uses: actions/cache@v2
  166. with:
  167. path: _build/default/lib/quicer/
  168. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  169. - name: build ${{ matrix.profile }}
  170. run: |
  171. . $HOME/.kerl/${{ matrix.otp }}/activate
  172. make ensure-rebar3
  173. sudo cp rebar3 /usr/local/bin/rebar3
  174. make ${{ matrix.profile }}-tgz
  175. - name: test
  176. run: |
  177. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  178. tar -zxf $pkg_name
  179. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  180. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  181. ready='no'
  182. for i in {1..10}; do
  183. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  184. ready='yes'
  185. break
  186. fi
  187. sleep 1
  188. done
  189. if [ "$ready" != "yes" ]; then
  190. echo "Timed out waiting for emqx to be ready"
  191. cat emqx/log/erlang.log.1
  192. exit 1
  193. fi
  194. ./emqx/bin/emqx_ctl status
  195. ./emqx/bin/emqx stop
  196. rm -rf emqx
  197. - uses: actions/upload-artifact@v2
  198. with:
  199. name: macos
  200. path: _packages/**/*.tar.gz
  201. spellcheck:
  202. needs: linux
  203. strategy:
  204. matrix:
  205. profile:
  206. - emqx-edge
  207. - emqx
  208. - emqx-enterprise
  209. runs-on: ubuntu-20.04
  210. container: "ghcr.io/iequ1/emqx-schema-validate:0.3.0"
  211. steps:
  212. - uses: actions/download-artifact@v2
  213. name: Download schema dump
  214. with:
  215. name: "${{ matrix.profile }}_schema_dump"
  216. path: /tmp/
  217. - name: Run spellcheck
  218. run: |
  219. cd /LanguageTool
  220. bash start.sh > /dev/null &
  221. ./emqx_schema_validate /tmp/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json