aboutsummaryrefslogtreecommitdiffstats
path: root/.github/actions/build_ya/action.yml
blob: 273f21a1b22f5fd991e28ae652731ddcecb7c684 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build (ya make)
description: Build targets
inputs:
  build_target:
    required: false
    description: "build target"
  sanitizer:
    required: false
    description: "sanitizer type (address, memory, thread, undefined, leak)"

  bazel_remote_uri:
    required: false
    description: "bazel-remote endpoint"
  bazel_remote_username:
    required: false
    description: "bazel-remote username"
  bazel_remote_password:
    required: false
    description: "bazel-remote password"

runs:
  using: "composite"
  steps:
    - name: Init
      id: init
      shell: bash
      run: |
        echo "SHELLOPTS=xtrace" >> $GITHUB_ENV
        export TMP_DIR=$(pwd)/tmp_build
        echo "TMP_DIR=$TMP_DIR" >> $GITHUB_ENV
        rm -rf $TMP_DIR && mkdir $TMP_DIR
    
    - name: build
      shell: bash
      run: |
        extra_params=()

        if [ ! -z "${{ inputs.build_target }}" ]; then
          extra_params+=(--target="${{ inputs.build_target }}")
        fi
        
        if [ ! -z "${{ inputs.sanitizer }}" ] && [ "${{ inputs.sanitizer }}" != "none" ]; then
          extra_params+=(--sanitize="${{ inputs.sanitizer }}")
        fi
        
        if [ ! -z "${{ inputs.bazel_remote_uri }}" ]; then
          extra_params+=(--bazel-remote-store)
          extra_params+=(--bazel-remote-base-uri "${{ inputs.bazel_remote_uri }}")
        fi
        
        if [ ! -z "${{ inputs.bazel_remote_username }}" ]; then
          extra_params+=(--bazel-remote-username "${{ inputs.bazel_remote_username }}")
          extra_params+=(--bazel-remote-password "${{ inputs.bazel_remote_password }}")
          extra_params+=(--bazel-remote-put --add-result .o --yt-replace-result --yt-replace-result-rm-binaries)
        fi

        ./ya make --build relwithdebinfo --force-build-depends -D'BUILD_LANGUAGES=CPP PY3' -T --stat  \
          --log-file "$TMP_DIR/ya_log.txt" --evlog-file "$TMP_DIR/ya_evlog.jsonl" \
          --dump-graph --dump-graph-to-file "$TMP_DIR/ya_graph.json" \
          "${extra_params[@]}"

    - name: sync logs to s3
      if: always()
      shell: bash
      run: |
        echo "::group::s3-sync"
        s3cmd sync --acl-private --no-progress --stats --no-check-md5 "$TMP_DIR/" "$S3_BUCKET_PATH/build_logs/"
        echo "::endgroup::"