action.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. relwithdebinfo)
  53. build_type=relwithdebinfo
  54. ;;
  55. release-asan)
  56. build_type=release
  57. extra_params+=(--sanitize="address")
  58. extra_params+=(-DSKIP_JUNK -DUSE_EAT_MY_DATA -DDEBUGINFO_LINES_ONLY)
  59. ;;
  60. release-tsan)
  61. build_type=release
  62. extra_params+=(--sanitize="thread")
  63. extra_params+=(-DSKIP_JUNK -DUSE_EAT_MY_DATA -DDEBUGINFO_LINES_ONLY)
  64. ;;
  65. *)
  66. echo "Invalid preset: ${{ inputs.build_preset }}"
  67. exit 1
  68. ;;
  69. esac
  70. ./ya make --build "${build_type}" --force-build-depends -D'BUILD_LANGUAGES=CPP PY3' -T --stat \
  71. --log-file "$TMP_DIR/ya_log.txt" --evlog-file "$TMP_DIR/ya_evlog.jsonl" \
  72. --dump-graph --dump-graph-to-file "$TMP_DIR/ya_graph.json" \
  73. --cache-size 512G --link-threads "${{ inputs.link_threads }}" \
  74. "${extra_params[@]}"
  75. - name: sync logs to s3
  76. if: always()
  77. shell: bash
  78. run: |
  79. echo "::group::s3-sync"
  80. s3cmd sync --acl-private --no-progress --stats --no-check-md5 "$TMP_DIR/" "$S3_BUCKET_PATH/build_logs/"
  81. echo "::endgroup::"
  82. - name: show free space
  83. if: always()
  84. shell: bash
  85. run: df -h