action.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. name: Build (ya make)
  2. description: Build targets
  3. inputs:
  4. build_target:
  5. required: false
  6. description: "build target"
  7. build_preset:
  8. required: true
  9. default: "relwithdebinfo"
  10. description: "relwithdebinfo, release-asan, release-tsan"
  11. bazel_remote_uri:
  12. required: false
  13. description: "bazel-remote endpoint"
  14. bazel_remote_username:
  15. required: false
  16. description: "bazel-remote username"
  17. bazel_remote_password:
  18. required: false
  19. description: "bazel-remote password"
  20. link_threads:
  21. required: false
  22. default: "8"
  23. description: "link threads count"
  24. runs:
  25. using: "composite"
  26. steps:
  27. - name: Init
  28. id: init
  29. shell: bash
  30. run: |
  31. echo "SHELLOPTS=xtrace" >> $GITHUB_ENV
  32. export TMP_DIR=$(pwd)/tmp_build
  33. echo "TMP_DIR=$TMP_DIR" >> $GITHUB_ENV
  34. rm -rf $TMP_DIR && mkdir $TMP_DIR
  35. - name: build
  36. shell: bash
  37. run: |
  38. extra_params=()
  39. if [ ! -z "${{ inputs.build_target }}" ]; then
  40. extra_params+=(--target="${{ inputs.build_target }}")
  41. fi
  42. if [ ! -z "${{ inputs.bazel_remote_uri }}" ]; then
  43. extra_params+=(--bazel-remote-store)
  44. extra_params+=(--bazel-remote-base-uri "${{ inputs.bazel_remote_uri }}")
  45. fi
  46. if [ ! -z "${{ inputs.bazel_remote_username }}" ]; then
  47. extra_params+=(--bazel-remote-username "${{ inputs.bazel_remote_username }}")
  48. extra_params+=(--bazel-remote-password "${{ inputs.bazel_remote_password }}")
  49. extra_params+=(--bazel-remote-put --dist-cache-evict-bins --add-result .o)
  50. fi
  51. case "${{ inputs.build_preset }}" in
  52. debug)
  53. build_type=debug
  54. ;;
  55. relwithdebinfo)
  56. build_type=relwithdebinfo
  57. ;;
  58. release-asan)
  59. build_type=release
  60. extra_params+=(--sanitize="address")
  61. extra_params+=(-DSKIP_JUNK -DUSE_EAT_MY_DATA -DDEBUGINFO_LINES_ONLY)
  62. ;;
  63. release-tsan)
  64. build_type=release
  65. extra_params+=(--sanitize="thread")
  66. extra_params+=(-DSKIP_JUNK -DUSE_EAT_MY_DATA -DDEBUGINFO_LINES_ONLY)
  67. ;;
  68. *)
  69. echo "Invalid preset: ${{ inputs.build_preset }}"
  70. exit 1
  71. ;;
  72. esac
  73. ./ya make -k --build "${build_type}" --force-build-depends -D'BUILD_LANGUAGES=CPP PY3 PY2 GO' -T --stat \
  74. --log-file "$TMP_DIR/ya_log.txt" --evlog-file "$TMP_DIR/ya_evlog.jsonl" \
  75. --cache-size 512G --link-threads "${{ inputs.link_threads }}" \
  76. "${extra_params[@]}"
  77. - name: sync logs to s3
  78. if: always()
  79. shell: bash
  80. run: |
  81. echo "::group::s3-sync"
  82. s3cmd sync --acl-private --no-progress --stats --no-check-md5 "$TMP_DIR/" "$S3_BUCKET_PATH/build_logs/"
  83. echo "::endgroup::"
  84. - name: show free space
  85. if: always()
  86. shell: bash
  87. run: df -h