run_relup_tests.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. name: Release Upgrade Tests
  2. concurrency:
  3. group: relup-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. workflow_call:
  7. inputs:
  8. builder:
  9. required: true
  10. type: string
  11. permissions:
  12. contents: read
  13. jobs:
  14. relup_test_plan:
  15. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  16. container: ${{ inputs.builder }}
  17. outputs:
  18. CUR_EE_VSN: ${{ steps.find-versions.outputs.CUR_EE_VSN }}
  19. OLD_VERSIONS: ${{ steps.find-versions.outputs.OLD_VERSIONS }}
  20. defaults:
  21. run:
  22. shell: bash
  23. steps:
  24. - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
  25. with:
  26. name: emqx-enterprise
  27. - name: extract artifact
  28. run: |
  29. unzip -o -q emqx-enterprise.zip
  30. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  31. - name: Find versions
  32. id: find-versions
  33. run: |
  34. set -x
  35. ee_vsn="$(./pkg-vsn.sh enterprise)"
  36. old_ee_vsns="$(./scripts/relup-build/base-vsns.sh enterprise | xargs)"
  37. old_vsns=$(echo -n "${old_ee_vsns}" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
  38. echo "CUR_EE_VSN=$ee_vsn" >> $GITHUB_OUTPUT
  39. echo "OLD_VERSIONS=$old_vsns" >> $GITHUB_OUTPUT
  40. - name: build emqx
  41. run: |
  42. export PROFILE='emqx-enterprise'
  43. make emqx-enterprise-tgz
  44. - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
  45. name: Upload built emqx and test scenario
  46. with:
  47. name: relup_tests_emqx_built
  48. path: |
  49. _upgrade_base
  50. _packages
  51. scripts
  52. .ci
  53. retention-days: 7
  54. relup_test_run:
  55. needs:
  56. - relup_test_plan
  57. if: needs.relup_test_plan.outputs.OLD_VERSIONS != '[]'
  58. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  59. strategy:
  60. fail-fast: false
  61. matrix:
  62. old_vsn: ${{ fromJson(needs.relup_test_plan.outputs.OLD_VERSIONS) }}
  63. env:
  64. OLD_VSN: "${{ matrix.old_vsn }}"
  65. CUR_EE_VSN: "${{ needs.relup_test_plan.outputs.CUR_EE_VSN }}"
  66. defaults:
  67. run:
  68. shell: bash
  69. steps:
  70. - uses: erlef/setup-beam@2f0cc07b4b9bea248ae098aba9e1a8a1de5ec24c # v1.17.5
  71. with:
  72. otp-version: 26.2.1
  73. - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
  74. with:
  75. repository: hawk/lux
  76. ref: lux-2.8.1
  77. path: lux
  78. - name: Install lux
  79. run: |
  80. set -eu
  81. cd lux
  82. autoconf
  83. ./configure
  84. make
  85. echo "$(pwd)/bin" >> $GITHUB_PATH
  86. - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
  87. name: Download built emqx and test scenario
  88. with:
  89. name: relup_tests_emqx_built
  90. path: .
  91. - name: run relup test
  92. run: |
  93. set -eux
  94. case "$OLD_VSN" in
  95. e*)
  96. export CUR_VSN="$CUR_EE_VSN"
  97. ;;
  98. *)
  99. echo "unknown old version $OLD_VSN"
  100. exit 1
  101. ;;
  102. esac
  103. mkdir -p lux_logs
  104. if ! ./scripts/relup-test/run-relup-lux.sh $OLD_VSN; then
  105. docker logs node1.emqx.io | tee lux_logs/emqx1.log
  106. docker logs node2.emqx.io | tee lux_logs/emqx2.log
  107. exit 1
  108. fi
  109. - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
  110. name: Save debug data
  111. if: failure()
  112. with:
  113. name: relup_test_run_debug_data
  114. path: |
  115. lux_logs
  116. retention-days: 3