build_slim_packages.yaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. tags:
  8. - v*
  9. - e*
  10. pull_request:
  11. # GitHub pull_request action is by default triggered when
  12. # opened reopened or synchronize,
  13. # we add labeled and unlabeled to the list because
  14. # the mac job dpends on the PR having a 'Mac' label
  15. types:
  16. - labeled
  17. - unlabeled
  18. - opened
  19. - reopened
  20. - synchronize
  21. workflow_dispatch:
  22. jobs:
  23. linux:
  24. runs-on: ubuntu-20.04
  25. strategy:
  26. fail-fast: false
  27. matrix:
  28. profile:
  29. - emqx-edge
  30. - emqx
  31. - emqx-enterprise
  32. otp:
  33. - 24.1.5-3
  34. os:
  35. - ubuntu20.04
  36. - centos7
  37. container: "ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}"
  38. steps:
  39. - uses: actions/checkout@v1
  40. - name: prepare
  41. run: |
  42. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  43. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  44. echo "EMQX_PKG_NAME=${{ matrix.profile }}-$(./pkg-vsn.sh)-otp${{ matrix.otp }}-${{ matrix.os }}-amd64" >> $GITHUB_ENV
  45. - name: Get deps git refs for cache
  46. id: deps-refs
  47. run: |
  48. rebar3 get-deps
  49. RocksDBRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"rocksdb">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  50. echo "::set-output name=DEP_ROCKSDB_REF::${RocksDBRef}"
  51. QuicerRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"quicer">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  52. echo "::set-output name=DEP_QUICER_REF::${QuicerRef}"
  53. make clean-all
  54. - name: load rocksdb cache
  55. uses: actions/cache@v2
  56. with:
  57. path: _build/default/lib/rocksdb/
  58. key: ${{ matrix.os }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  59. - name: load quicer cache
  60. uses: actions/cache@v2
  61. with:
  62. path: _build/default/lib/quicer/
  63. key: ${{ matrix.os }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  64. - name: build and test zip package
  65. run: |
  66. make ${EMQX_NAME}-zip
  67. .ci/build_packages/tests.sh "$EMQX_PKG_NAME" zip
  68. - name: build and test deb/rpm packages
  69. run: |
  70. make ${EMQX_NAME}-pkg
  71. .ci/build_packages/tests.sh "$EMQX_PKG_NAME" pkg
  72. - uses: actions/upload-artifact@v2
  73. with:
  74. name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
  75. path: _packages/**/*.zip
  76. mac:
  77. strategy:
  78. fail-fast: false
  79. matrix:
  80. profile:
  81. - emqx
  82. - emqx-enterprise
  83. otp:
  84. - 24.1.5-3
  85. macos:
  86. - macos-11
  87. - macos-10.15
  88. runs-on: ${{ matrix.macos }}
  89. steps:
  90. - uses: actions/checkout@v2
  91. - name: prepare
  92. run: |
  93. brew update
  94. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  95. echo "/usr/local/bin" >> $GITHUB_PATH
  96. echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
  97. - uses: actions/cache@v2
  98. id: cache
  99. with:
  100. path: ~/.kerl
  101. key: otp-${{ matrix.otp }}-${{ matrix.macos }}
  102. - name: build erlang
  103. if: steps.cache.outputs.cache-hit != 'true'
  104. timeout-minutes: 60
  105. env:
  106. KERL_BUILD_BACKEND: git
  107. OTP_GITHUB_URL: https://github.com/emqx/otp
  108. run: |
  109. kerl update releases
  110. kerl build ${{ matrix.otp }}
  111. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  112. - name: Get deps git refs for cache
  113. id: deps-refs
  114. run: |
  115. . $HOME/.kerl/${{ matrix.otp }}/activate
  116. make ensure-rebar3
  117. sudo cp rebar3 /usr/local/bin/rebar3
  118. rebar3 get-deps
  119. RocksDBRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"rocksdb">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  120. echo "::set-output name=DEP_ROCKSDB_REF::${RocksDBRef}"
  121. QuicerRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"quicer">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  122. echo "::set-output name=DEP_QUICER_REF::${QuicerRef}"
  123. make clean-all
  124. - name: load rocksdb cache
  125. uses: actions/cache@v2
  126. with:
  127. path: _build/default/lib/rocksdb/
  128. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  129. - name: load quicer cache
  130. uses: actions/cache@v2
  131. with:
  132. path: _build/default/lib/quicer/
  133. key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  134. - name: build ${{ matrix.profile }}
  135. run: |
  136. . $HOME/.kerl/${{ matrix.otp }}/activate
  137. make ensure-rebar3
  138. sudo cp rebar3 /usr/local/bin/rebar3
  139. make ${{ matrix.profile }}-zip
  140. - name: test
  141. run: |
  142. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.zip)
  143. unzip -q $pkg_name
  144. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  145. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  146. ready='no'
  147. for i in {1..10}; do
  148. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  149. ready='yes'
  150. break
  151. fi
  152. sleep 1
  153. done
  154. if [ "$ready" != "yes" ]; then
  155. echo "Timed out waiting for emqx to be ready"
  156. cat emqx/log/erlang.log.1
  157. exit 1
  158. fi
  159. ./emqx/bin/emqx_ctl status
  160. ./emqx/bin/emqx stop
  161. rm -rf emqx
  162. - uses: actions/upload-artifact@v2
  163. with:
  164. name: macos
  165. path: _packages/**/*.zip