action.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. cd ../build
  27. rm -rf *
  28. export CC=/usr/bin/clang-14
  29. export CC_FOR_BUILD=$CC
  30. cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  31. -DCCACHE_PATH=/usr/local/bin/ccache \
  32. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  33. -DCMAKE_CXX_FLAGS="-fsanitize=${{ inputs.sanitizer }} -g -gsplit-dwarf -gz -fno-omit-frame-pointer ${{ inputs.extra_compile_flags }}" \
  34. -DCMAKE_C_FLAGS="-fsanitize=${{ inputs.sanitizer }} -g -gsplit-dwarf -gz -fno-omit-frame-pointer ${{ inputs.extra_compile_flags }}" \
  35. ../ydb
  36. - name: Configure
  37. shell: bash
  38. if: ${{!inputs.sanitizer}}
  39. run: |
  40. mkdir -p ../build
  41. cd ../build
  42. rm -rf *
  43. export CONAN_USER_HOME=`pwd`
  44. export CC=/usr/bin/clang-14
  45. export CC_FOR_BUILD=$CC
  46. # FIXME: set DCMAKE_CXX_FLAGS_RELWITHDEBINFO and DCMAKE_CXX_FLAGS bacause of global_flags.cmake flags override.
  47. cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  48. -DCCACHE_PATH=/usr/local/bin/ccache \
  49. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  50. -DCMAKE_C_FLAGS="${{ inputs.extra_compile_flags }}" \
  51. -DCMAKE_CXX_FLAGS="${{ inputs.extra_compile_flags }}" \
  52. ../ydb
  53. - name: Build
  54. shell: bash
  55. run: |
  56. ccache -z
  57. export CCACHE_BASEDIR=`realpath ..`
  58. export CCACHE_REMOTE_STORAGE="${{inputs.ccache_remote_path}}"
  59. export CCACHE_SLOPPINESS=locale
  60. export CCACHE_MAXSIZE=50G
  61. cd ../build
  62. ninja ${{ inputs.ninja_target }}
  63. ccache -s
  64. df -h
  65. - name: report Build failed
  66. if: ${{ failure() }}
  67. shell: bash
  68. run: |
  69. echo "# Build failed" >> $GITHUB_STEP_SUMMARY
  70. - name: report Build cancelled
  71. if: ${{ cancelled() }}
  72. shell: bash
  73. run: |
  74. echo "# Build cancelled" >> $GITHUB_STEP_SUMMARY