build_slim_packages.yaml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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
  29. - emqx-enterprise
  30. otp:
  31. - 24.2.1-1
  32. elixir:
  33. - 1.13.4
  34. os:
  35. - ubuntu20.04
  36. - el8
  37. container: "ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  38. steps:
  39. - uses: AutoModality/action-clean@v1
  40. - uses: actions/checkout@v2
  41. with:
  42. fetch-depth: 0
  43. - name: prepare
  44. run: |
  45. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  46. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  47. - name: Get deps git refs for cache
  48. id: deps-refs
  49. run: |
  50. git config --global --add safe.directory "/__w/emqx/emqx"
  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. echo "BUILD_WITH_QUIC=1" >> $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. env:
  167. AUTO_INSTALL_BUILD_DEPS: 1
  168. run: |
  169. . $HOME/.kerl/${{ matrix.otp }}/activate
  170. make ensure-rebar3
  171. sudo cp rebar3 /usr/local/bin/rebar3
  172. scripts/get-dep-refs.sh
  173. make clean-all
  174. - name: load quicer cache
  175. uses: actions/cache@v2
  176. with:
  177. path: _build/default/lib/quicer/
  178. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  179. - name: build ${{ matrix.profile }}
  180. env:
  181. AUTO_INSTALL_BUILD_DEPS: 1
  182. run: |
  183. . $HOME/.kerl/${{ matrix.otp }}/activate
  184. make ensure-rebar3
  185. sudo cp rebar3 /usr/local/bin/rebar3
  186. make ${{ matrix.profile }}-tgz
  187. - name: test
  188. run: |
  189. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  190. mkdir -p emqx
  191. tar -C emqx -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..30}; 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
  214. spellcheck:
  215. needs: linux
  216. strategy:
  217. matrix:
  218. profile:
  219. - emqx
  220. - emqx-enterprise
  221. runs-on: aws-amd64
  222. container: "ghcr.io/emqx/emqx-schema-validate:0.3.3"
  223. steps:
  224. - uses: actions/download-artifact@v2
  225. name: Download schema dump
  226. with:
  227. name: "${{ matrix.profile }}_schema_dump"
  228. path: /tmp/
  229. - name: Run spellcheck
  230. run: |
  231. cd /LanguageTool
  232. bash start.sh > /dev/null &
  233. ./emqx_schema_validate /tmp/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json
  234. allgood_packaging:
  235. runs-on: ubuntu-latest
  236. needs:
  237. - linux
  238. - windows
  239. - mac
  240. steps:
  241. - name: Check if all packging builds succeeded
  242. uses: re-actors/alls-green@release/v1
  243. with:
  244. #allowed-failures:
  245. #allowed-skips:
  246. jobs: ${{ toJSON(needs) }}