run_relup_tests.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. name: Release Upgrade Tests
  2. concurrency:
  3. group: relup-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. branches:
  8. - '**'
  9. tags:
  10. - v*
  11. - e*
  12. pull_request:
  13. jobs:
  14. relup_test_plan:
  15. runs-on: ubuntu-20.04
  16. container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04"
  17. outputs:
  18. CUR_CE_VSN: ${{ steps.find-versions.outputs.CUR_CE_VSN }}
  19. CUR_EE_VSN: ${{ steps.find-versions.outputs.CUR_EE_VSN }}
  20. OLD_VERSIONS: ${{ steps.find-versions.outputs.OLD_VERSIONS }}
  21. defaults:
  22. run:
  23. shell: bash
  24. steps:
  25. - uses: actions/checkout@v2
  26. name: Checkout
  27. with:
  28. path: emqx
  29. fetch-depth: 0
  30. - name: Find versions
  31. id: find-versions
  32. run: |
  33. set -x
  34. cd emqx
  35. ce_vsn="$(./pkg-vsn.sh opensource)"
  36. ee_vsn="$(./pkg-vsn.sh enterprise)"
  37. old_ce_vsns="$(./scripts/relup-base-vsns.sh opensource | xargs)"
  38. old_ee_vsns="$(./scripts/relup-base-vsns.sh enterprise | xargs)"
  39. old_vsns=$(echo -n "${old_ce_vsns} ${old_ee_vsns}" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
  40. echo "::set-output name=CUR_CE_VSN::$ce_vsn"
  41. echo "::set-output name=CUR_EE_VSN::$ee_vsn"
  42. echo "::set-output name=OLD_VERSIONS::$old_vsns"
  43. - name: build emqx
  44. run: |
  45. set -x
  46. cd emqx
  47. make emqx-tgz
  48. make emqx-enterprise-tgz
  49. - uses: actions/upload-artifact@v2
  50. name: Upload built emqx and test scenario
  51. with:
  52. name: emqx_built
  53. path: |
  54. emqx/_upgrade_base
  55. emqx/_packages
  56. emqx/scripts
  57. emqx/.ci
  58. relup_test_run:
  59. needs:
  60. - relup_test_plan
  61. runs-on: ubuntu-20.04
  62. strategy:
  63. fail-fast: false
  64. matrix:
  65. old_vsn: ${{ fromJson(needs.relup_test_plan.outputs.OLD_VERSIONS) }}
  66. env:
  67. OLD_VSN: "${{ matrix.old_vsn }}"
  68. CUR_CE_VSN: "${{ needs.relup_test_plan.outputs.CUR_CE_VSN }}"
  69. CUR_EE_VSN: "${{ needs.relup_test_plan.outputs.CUR_EE_VSN }}"
  70. defaults:
  71. run:
  72. shell: bash
  73. steps:
  74. # setup Erlang to run lux
  75. - uses: erlef/setup-beam@v1
  76. with:
  77. otp-version: "24.2"
  78. - uses: actions/checkout@v2
  79. with:
  80. repository: hawk/lux
  81. ref: lux-2.8.1
  82. path: lux
  83. - name: Install lux
  84. run: |
  85. set -e -u -x
  86. cd lux
  87. autoconf
  88. ./configure
  89. make
  90. echo "$(pwd)/bin" >> $GITHUB_PATH
  91. - uses: actions/download-artifact@v2
  92. name: Download built emqx and test scenario
  93. with:
  94. name: emqx_built
  95. path: .
  96. - name: run relup test
  97. run: |
  98. set -e -x -u
  99. chmod a+x scripts/**/*.sh
  100. ls -l scripts
  101. ls -l scripts/relup-test
  102. case "$OLD_VSN" in
  103. e*)
  104. export CUR_VSN="$CUR_EE_VSN"
  105. ;;
  106. v*)
  107. export CUR_VSN="$CUR_CE_VSN"
  108. ;;
  109. *)
  110. echo "unknown old version $OLD_VSN"
  111. exit 1
  112. ;;
  113. esac
  114. mkdir -p lux_logs
  115. if ! ./scripts/relup-test/run-relup-lux.sh $OLD_VSN; then
  116. docker logs node1.emqx.io | tee lux_logs/emqx1.log
  117. docker logs node2.emqx.io | tee lux_logs/emqx2.log
  118. exit 1
  119. fi
  120. - uses: actions/upload-artifact@v2
  121. name: Save debug data
  122. if: failure()
  123. with:
  124. name: debug_data
  125. path: |
  126. lux_logs