build_slim_packages.yaml 6.3 KB

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