win_test_template.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. name: Windows Test Template
  2. on:
  3. workflow_call:
  4. inputs:
  5. CTEST_START:
  6. required: false
  7. type: number
  8. default: 1
  9. CTEST_END:
  10. required: false
  11. type: number
  12. default: 999999
  13. artifact_name:
  14. required: true
  15. type: string
  16. COLUMNAR_LOCATOR:
  17. required: false
  18. type: string
  19. default: ""
  20. jobs:
  21. test_windows:
  22. name: ${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
  23. runs-on: windows-2022
  24. env:
  25. CACHEB: "../cache"
  26. LIBS_BUNDLE: "../bundle"
  27. BOOST_ROOT: "../boost_1_75_0"
  28. CTEST_CMAKE_GENERATOR: "Visual Studio 17 2022"
  29. CTEST_CONFIGURATION_TYPE: Debug
  30. CTEST_START: ${{ inputs.CTEST_START }}
  31. CTEST_END: ${{ inputs.CTEST_END }}
  32. CTEST_RESOURCE: ${{ github.workspace }}\\misc\\ctest\\ubertests\\ubertests_docker_image\\resource.json
  33. # The following is useful to test a specific test, just uncomment it, no need to disable CTEST_START/END
  34. # CTEST_REGEX: test_234
  35. NO_BUILD: 1
  36. COLUMNAR_LOCATOR: ${{ inputs.COLUMNAR_LOCATOR }}
  37. steps:
  38. - name: Checkout repository # We have to checkout to access .github/workflows/ in further steps
  39. uses: actions/checkout@v3
  40. - name: Download build artifacts
  41. uses: manticoresoftware/download_artifact_with_retries@v3
  42. with:
  43. name: build_windows_Debug_x64
  44. path: .
  45. - name: Check out Windows bundle cache
  46. uses: actions/cache@v4
  47. with:
  48. path: |
  49. bundle
  50. boost_1_75_0
  51. enableCrossOsArchive: true
  52. key: win_bundle
  53. - name: Remove ZSTD # since it wasn't used to save the cache and if we don't remove it here the cache won't be found. TODO: install zstd in our images, so we don't have to do these hacks
  54. run: rm C:\tools\zstd\zstd.exe
  55. - name: Check out cache
  56. uses: actions/cache@v4
  57. with:
  58. path: cache
  59. enableCrossOsArchive: true
  60. key: build_windows_x64
  61. - name: Run mysql
  62. run: |
  63. C:\PROGRA~1\MySQL\"MySQL Server 8.0"\bin\mysqld.exe --initialize-insecure
  64. C:\PROGRA~1\MySQL\"MySQL Server 8.0"\bin\mysqld.exe --install mysql
  65. net start mysql
  66. mysql -e "create user 'test'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; create database test; create database test1; create database test2; create database test3; create database test4; create database test5; create database test6; create database test7; create database test8; create database test9; grant all on test.* to 'test'@'localhost'; grant all on test1.* to 'test'@'localhost'; grant all on test2.* to 'test'@'localhost'; grant all on test3.* to 'test'@'localhost'; grant all on test4.* to 'test'@'localhost'; grant all on test5.* to 'test'@'localhost'; grant all on test6.* to 'test'@'localhost'; grant all on test7.* to 'test'@'localhost'; grant all on test8.* to 'test'@'localhost'; grant all on test9.* to 'test'@'localhost'; flush privileges;" -uroot
  67. # TODO: Uncomment the below if there's no more OpenSSL in the runner like it happened in Sep 2023 (https://github.com/actions/runner-images/issues/8344)
  68. # - name: Install OpenSSL
  69. # run: powershell.exe ./.github/workflows/Install-OpenSSL.ps1
  70. - name: Setup PHP and mysqli
  71. uses: shivammathur/setup-php@v2
  72. with:
  73. php-version: '8.2'
  74. extensions: mysqli
  75. - name: 🚀 Test
  76. id: test
  77. # --timeout may be not working https://gitlab.kitware.com/cmake/cmake/-/issues/23979
  78. # Add -VV to ctest to display extra debug info
  79. run: ctest -VV -S misc/ctest/gltest.cmake --no-compress-output --timeout 600
  80. continue-on-error: true
  81. - name: Prepare test results
  82. if: always()
  83. run: |
  84. mkdir build/xml_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
  85. cp -r build/Testing/2*/*.xml build/xml_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}/
  86. cp -r build/test build/test_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
  87. continue-on-error: true
  88. - name: Upload test artifacts
  89. if: always()
  90. continue-on-error: true
  91. uses: manticoresoftware/upload_artifact_with_retries@v4
  92. with:
  93. name: ${{ inputs.artifact_name }}
  94. path: "build/xml* build/test_*/test_*/report* build/test_*/error*.txt build/test_*/*log build/status* build/test_*/*mdmp"
  95. report_windows:
  96. name: Windows tests summary and report
  97. needs: test_windows
  98. runs-on: ubuntu-22.04
  99. container:
  100. image: manticoresearch/ubertests_public:331
  101. steps:
  102. - name: Checkout repository
  103. uses: actions/checkout@v3
  104. - name: Download test report artifacts
  105. uses: manticoresoftware/download_artifact_with_retries@v3
  106. continue-on-error: true
  107. with:
  108. name: ${{ inputs.artifact_name }}
  109. path: .
  110. - name: Convert the XML to JUnit format
  111. run: |
  112. shopt -s nullglob
  113. for dir in build/xml_*; do
  114. if [ -d "$dir" ] && [ -f "$dir/Test.xml" ]; then
  115. xsltproc -o "$dir/junit_tests.xml" misc/junit/ctest2junit.xsl "$dir/Test.xml"
  116. fi
  117. done
  118. shell: bash
  119. - name: Publish test results
  120. uses: manticoresoftware/publish-unit-test-result-action@v2
  121. with:
  122. check_name: Windows test results
  123. compare_to_earlier_commit: false
  124. files: build/xml_*/junit_tests.xml
  125. comment_mode: failures
  126. - name: Verify test job result
  127. run: |
  128. if [[ "${{ needs.test_windows.result }}" != "success" ]]; then
  129. echo "Windows tests job failed (result: ${{ needs.test_windows.result }})"
  130. exit 1
  131. fi
  132. shell: bash
  133. - name: Upload combined artifacts
  134. if: always()
  135. continue-on-error: true
  136. uses: manticoresoftware/upload_artifact_with_retries@v4
  137. with:
  138. name: ${{ inputs.artifact_name }}
  139. path: build