build_slim_packages.yaml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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: aws-amd64
  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. - el8
  38. container: "ghcr.io/emqx/emqx-builder/5.0-14:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  39. steps:
  40. - uses: AutoModality/action-clean@v1
  41. - uses: actions/checkout@v2
  42. with:
  43. fetch-depth: 0
  44. - name: prepare
  45. run: |
  46. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  47. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  48. - name: Get deps git refs for cache
  49. id: deps-refs
  50. run: |
  51. scripts/get-dep-refs.sh
  52. make clean-all
  53. - name: load quicer cache
  54. uses: actions/cache@v2
  55. with:
  56. path: |
  57. _build/default/lib/quicer/
  58. deps/quicer/
  59. key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  60. - name: Work around https://github.com/actions/checkout/issues/766
  61. run: |
  62. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  63. - name: build and test tgz package
  64. run: |
  65. make ${EMQX_NAME}-tgz
  66. ./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
  67. - name: run static checks
  68. if: contains(matrix.os, 'ubuntu')
  69. run: |
  70. make static_checks
  71. - name: build and test deb/rpm packages
  72. run: |
  73. make ${EMQX_NAME}-pkg
  74. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  75. - name: build and test tgz package (Elixir)
  76. run: |
  77. make ${EMQX_NAME}-elixir-tgz
  78. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-tgz
  79. - name: build and test deb/rpm packages (Elixir)
  80. run: |
  81. make ${EMQX_NAME}-elixir-pkg
  82. ./scripts/pkg-tests.sh ${EMQX_NAME}-elixir-pkg
  83. - uses: actions/upload-artifact@v2
  84. with:
  85. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  86. path: _packages/${{ matrix.profile}}/*.tar.gz
  87. - uses: actions/upload-artifact@v2
  88. with:
  89. name: "${{ matrix.profile }}_schema_dump"
  90. path: _build/*/lib/emqx_dashboard/priv/www/static/schema.json
  91. windows:
  92. runs-on: windows-2019
  93. strategy:
  94. fail-fast: false
  95. matrix:
  96. profile:
  97. - emqx
  98. otp:
  99. - 24.2.1
  100. steps:
  101. - uses: actions/checkout@v2
  102. - uses: ilammy/msvc-dev-cmd@v1
  103. - uses: erlef/setup-beam@v1
  104. with:
  105. otp-version: ${{ matrix.otp }}
  106. - name: build
  107. env:
  108. PYTHON: python
  109. DIAGNOSTIC: 1
  110. run: |
  111. # ensure crypto app (openssl)
  112. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  113. make ${{ matrix.profile }}-tgz
  114. - name: run emqx
  115. timeout-minutes: 5
  116. run: |
  117. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  118. Start-Sleep -s 5
  119. echo "EMQX started"
  120. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  121. echo "EMQX stopped"
  122. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  123. echo "EMQX installed"
  124. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  125. echo "EMQX uninstalled"
  126. mac:
  127. strategy:
  128. fail-fast: false
  129. matrix:
  130. profile:
  131. - emqx
  132. - emqx-enterprise
  133. otp:
  134. - 24.2.1-1
  135. macos:
  136. - macos-11
  137. - macos-10.15
  138. runs-on: ${{ matrix.macos }}
  139. steps:
  140. - uses: actions/checkout@v2
  141. - name: prepare
  142. run: |
  143. brew update
  144. brew install curl zip unzip kerl
  145. echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
  146. echo "/usr/local/bin" >> $GITHUB_PATH
  147. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  148. - uses: actions/cache@v2
  149. id: cache
  150. with:
  151. path: ~/.kerl/${{ matrix.otp }}
  152. key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
  153. - name: build erlang
  154. if: steps.cache.outputs.cache-hit != 'true'
  155. timeout-minutes: 60
  156. env:
  157. KERL_BUILD_BACKEND: git
  158. OTP_GITHUB_URL: https://github.com/emqx/otp
  159. run: |
  160. kerl update releases
  161. kerl build ${{ matrix.otp }}
  162. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  163. - name: Get deps git refs for cache
  164. id: deps-refs
  165. env:
  166. AUTO_INSTALL_BUILD_DEPS: 1
  167. run: |
  168. . $HOME/.kerl/${{ matrix.otp }}/activate
  169. make ensure-rebar3
  170. sudo cp rebar3 /usr/local/bin/rebar3
  171. scripts/get-dep-refs.sh
  172. make clean-all
  173. - name: load quicer cache
  174. uses: actions/cache@v2
  175. with:
  176. path: _build/default/lib/quicer/
  177. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  178. - name: build ${{ matrix.profile }}
  179. env:
  180. AUTO_INSTALL_BUILD_DEPS: 1
  181. run: |
  182. . $HOME/.kerl/${{ matrix.otp }}/activate
  183. make ensure-rebar3
  184. sudo cp rebar3 /usr/local/bin/rebar3
  185. make ${{ matrix.profile }}-tgz
  186. - name: test
  187. run: |
  188. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  189. tar -zxf $pkg_name
  190. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  191. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  192. ready='no'
  193. for i in {1..30}; do
  194. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  195. ready='yes'
  196. break
  197. fi
  198. sleep 1
  199. done
  200. if [ "$ready" != "yes" ]; then
  201. echo "Timed out waiting for emqx to be ready"
  202. cat emqx/log/erlang.log.1
  203. exit 1
  204. fi
  205. ./emqx/bin/emqx_ctl status
  206. ./emqx/bin/emqx stop
  207. rm -rf emqx
  208. - uses: actions/upload-artifact@v2
  209. with:
  210. name: macos
  211. path: _packages/**/*.tar.gz
  212. spellcheck:
  213. needs: linux
  214. strategy:
  215. matrix:
  216. profile:
  217. - emqx-edge
  218. - emqx
  219. - emqx-enterprise
  220. runs-on: aws-amd64
  221. container: "ghcr.io/iequ1/emqx-schema-validate:0.3.1"
  222. steps:
  223. - uses: actions/download-artifact@v2
  224. name: Download schema dump
  225. with:
  226. name: "${{ matrix.profile }}_schema_dump"
  227. path: /tmp/
  228. - name: Run spellcheck
  229. run: |
  230. cd /LanguageTool
  231. bash start.sh > /dev/null &
  232. ./emqx_schema_validate /tmp/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json
  233. allgood_packaging:
  234. runs-on: ubuntu-latest
  235. needs:
  236. - linux
  237. - windows
  238. - mac
  239. steps:
  240. - name: Check if all packging builds succeeded
  241. uses: re-actors/alls-green@release/v1
  242. with:
  243. #allowed-failures:
  244. #allowed-skips:
  245. jobs: ${{ toJSON(needs) }}