build_template.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. name: Build Template
  2. on:
  3. workflow_call:
  4. inputs:
  5. arch:
  6. required: false
  7. type: string
  8. default: x86_64
  9. DISTR:
  10. required: false
  11. type: string
  12. default: jammy
  13. CTEST_CMAKE_GENERATOR:
  14. required: false
  15. type: string
  16. default: Ninja
  17. CTEST_CONFIGURATION_TYPE:
  18. required: false
  19. type: string
  20. default: RelWithDebInfo
  21. WITH_COVERAGE:
  22. required: false
  23. type: number
  24. default: 0
  25. UNITY_BUILD:
  26. required: false
  27. type: number
  28. default: 1
  29. version:
  30. required: false
  31. type: string
  32. default: ""
  33. build_tag:
  34. required: false
  35. type: string
  36. default: ""
  37. cmake_command:
  38. required: false
  39. type: string
  40. default: "ctest -VV -S misc/ctest/gltest.cmake --no-compress-output"
  41. cache_key:
  42. required: false
  43. type: string
  44. default: build_linux_x86_64
  45. boost_url_key:
  46. required: false
  47. type: string
  48. default: boost_nov22
  49. sysroot_url_key:
  50. required: false
  51. type: string
  52. default: roots_nov22
  53. artifact_list:
  54. required: false
  55. type: string
  56. default: "build/xml build/CMakeFiles/CMake*.log build/api/libsphinxclient/testcli build/src/indexer build/src/indextool build/src/searchd build/src/tests build/src/gtests/gmanticoretest build/config/*.c build/config/*.h build/**/*.cxx build/**/*.gcno"
  57. artifact_name:
  58. required: false
  59. type: string
  60. HOMEBREW_PREFIX:
  61. required: false
  62. type: string
  63. default:
  64. PACK_GALERA:
  65. required: false
  66. type: number
  67. default: 0
  68. COLUMNAR_LOCATOR:
  69. required: false
  70. type: string
  71. default: ""
  72. jobs:
  73. build:
  74. runs-on: ubuntu-22.04
  75. defaults:
  76. run:
  77. shell: bash
  78. timeout-minutes: 30
  79. container:
  80. image: manticoresearch/external_toolchain:vcpkg331_20250114
  81. env:
  82. CACHEB: "../cache"
  83. DIAGNOSTIC: 1
  84. PACK_ICUDATA: 0
  85. NO_TESTS: 1
  86. DISTR: ${{ inputs.DISTR }}
  87. boost: ${{ inputs.boost_url_key }}
  88. sysroot: ${{ inputs.sysroot_url_key }}
  89. arch: ${{ inputs.arch }}
  90. CTEST_CMAKE_GENERATOR: ${{ inputs.CTEST_CMAKE_GENERATOR }}
  91. CTEST_CONFIGURATION_TYPE: ${{ inputs.CTEST_CONFIGURATION_TYPE }}
  92. WITH_COVERAGE: ${{ inputs.WITH_COVERAGE }}
  93. UNITY_BUILD: ${{ inputs.UNITY_BUILD }}
  94. SYSROOT_URL: https://repo.manticoresearch.com/repository/sysroots
  95. HOMEBREW_PREFIX: ${{ inputs.HOMEBREW_PREFIX }}
  96. PACK_GALERA: ${{ inputs.PACK_GALERA }}
  97. COLUMNAR_LOCATOR: ${{ inputs.COLUMNAR_LOCATOR }}
  98. BUILD_TAG: ${{ inputs.build_tag }}
  99. steps:
  100. - name: Checkout repository
  101. uses: actions/checkout@v3
  102. with:
  103. token: ${{ secrets.GITHUB_TOKEN }}
  104. set-safe-directory: true
  105. - name: Patch version
  106. if: inputs.version != ''
  107. run: |
  108. sed -i "s/0\.0\.0/${{ inputs.version }}/g" src/sphinxversion.h.in
  109. cat src/sphinxversion.h.in
  110. - name: Initialization
  111. run: | # without adding the safe.directory cmake fails to do git log -1 --date=short --format=%cd
  112. bash /sysroot/root/entry_point.sh
  113. git config --global --add safe.directory /__w/manticoresearch/manticoresearch
  114. git config --global core.abbrev 9
  115. - name: Set output artifact name
  116. id: artifact_name
  117. run: |
  118. USER_INPUT=${{ inputs.artifact_name }}
  119. echo "value=${USER_INPUT:-"build_${{ inputs.DISTR }}_${{ inputs.CTEST_CONFIGURATION_TYPE }}_${{ inputs.arch }}"}" >> "$GITHUB_OUTPUT"
  120. - name: Check out cache before building
  121. uses: actions/cache@v4
  122. with:
  123. path: cache
  124. enableCrossOsArchive: true
  125. key: ${{ inputs.cache_key }}
  126. - name: 🚀 Build
  127. run: |
  128. ${{ inputs.cmake_command }}
  129. - name: Upload build artifacts
  130. if: success()
  131. uses: manticoresoftware/upload_artifact_with_retries@v4
  132. with:
  133. name: ${{ steps.artifact_name.outputs.value }}
  134. path: ${{ inputs.artifact_list }}