action.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: Build
  2. description: Build YDB
  3. inputs:
  4. sanitizer:
  5. required: false
  6. type: string
  7. ccache_remote_path:
  8. required: false
  9. description: "ccache remote storage definition"
  10. extra_compile_flags:
  11. required: false
  12. default: ""
  13. description: "extra compile flags will be added to the end of C_FLAGS and CXX_FLAGS"
  14. ninja_target:
  15. required: false
  16. type: string
  17. runs:
  18. using: "composite"
  19. steps:
  20. - name: Configure for sanitizer
  21. shell: bash
  22. if: inputs.sanitizer
  23. run: |
  24. mkdir -p ../build
  25. patch -p1 < ydb/deploy/patches/0001-sanitizer-build.patch
  26. # Temporary patch to dix difference between antlr4.9 and 4.13 behaviour
  27. sed -i 's/TOKEN(NULL)/TOKEN(NULL_)/g' ydb/public/lib/ydb_cli/commands/interactive/yql_highlight.cpp
  28. cd ../build
  29. rm -rf *
  30. export CC=/usr/bin/clang-16
  31. export CC_FOR_BUILD=$CC
  32. cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  33. -DCCACHE_PATH=/usr/local/bin/ccache \
  34. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  35. -DCMAKE_CXX_FLAGS="-fsanitize=${{ inputs.sanitizer }} -g -gsplit-dwarf -gz -fno-omit-frame-pointer ${{ inputs.extra_compile_flags }}" \
  36. -DCMAKE_C_FLAGS="-fsanitize=${{ inputs.sanitizer }} -g -gsplit-dwarf -gz -fno-omit-frame-pointer ${{ inputs.extra_compile_flags }}" \
  37. ../ydb
  38. - name: Configure
  39. shell: bash
  40. if: ${{!inputs.sanitizer}}
  41. run: |
  42. # Temporary patch to dix difference between antlr4.9 and 4.13 behaviour
  43. sed -i 's/TOKEN(NULL)/TOKEN(NULL_)/g' ydb/public/lib/ydb_cli/commands/interactive/yql_highlight.cpp
  44. mkdir -p ../build
  45. cd ../build
  46. rm -rf *
  47. export CONAN_USER_HOME=`pwd`
  48. export CC=/usr/bin/clang-16
  49. export CC_FOR_BUILD=$CC
  50. # FIXME: set DCMAKE_CXX_FLAGS_RELWITHDEBINFO and DCMAKE_CXX_FLAGS bacause of global_flags.cmake flags override.
  51. cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  52. -DCCACHE_PATH=/usr/local/bin/ccache \
  53. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  54. -DCMAKE_C_FLAGS="${{ inputs.extra_compile_flags }}" \
  55. -DCMAKE_CXX_FLAGS="${{ inputs.extra_compile_flags }}" \
  56. ../ydb
  57. - name: Build
  58. shell: bash
  59. run: |
  60. ccache -z
  61. export CCACHE_BASEDIR=`realpath ..`
  62. export CCACHE_REMOTE_STORAGE="${{inputs.ccache_remote_path}}"
  63. export CCACHE_SLOPPINESS=locale
  64. export CCACHE_MAXSIZE=50G
  65. cd ../build
  66. ninja ${{ inputs.ninja_target }}
  67. ccache -s
  68. df -h
  69. - name: report Build failed
  70. if: ${{ failure() }}
  71. shell: bash
  72. run: |
  73. echo "# Build failed" >> $GITHUB_STEP_SUMMARY
  74. - name: report Build cancelled
  75. if: ${{ cancelled() }}
  76. shell: bash
  77. run: |
  78. echo "# Build cancelled" >> $GITHUB_STEP_SUMMARY