Browse Source

Move some into test_ya action (#8937)

Maxim Yurchuk 6 months ago
parent
commit
a21caa5ae3
2 changed files with 82 additions and 82 deletions
  1. 0 82
      .github/actions/build_and_test_ya/action.yml
  2. 82 0
      .github/actions/test_ya/action.yml

+ 0 - 82
.github/actions/build_and_test_ya/action.yml

@@ -57,34 +57,6 @@ defaults:
 runs:
   using: "composite"
   steps:
-    - name: comment-build-start
-      if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
-      shell: bash
-      env:
-        BUILD_PRESET: ${{ inputs.build_preset }}
-        GITHUB_TOKEN: ${{ github.token }}
-      run: |
-        jobs_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs"
-        # tricky: we are searching job with name that contains build_preset
-        check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url')
-        
-        platform_name="$(echo "$(uname -s)-$(uname -p)" | tr '[:upper:]' '[:lower:]')-$BUILD_PRESET"
-        echo "Pre-commit [check]($check_url) **$platform_name** for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite
-
-        curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
-          https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
-          -d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'
-
-        if [[ "${{inputs.run_tests}}" == "true" ]];then
-          curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
-            https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
-            -d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
-        fi
-   
-    - name: Clean ya cache
-      shell: bash
-      run: rm -rf ~/.ya
-
     - name: Prepare s3cmd
       uses: ./.github/actions/s3cmd
       with:
@@ -116,57 +88,3 @@ runs:
         bazel_remote_password: ${{ fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }}
         put_build_results_to_cache: ${{ inputs.put_build_results_to_cache }}
         test_retry_count: ${{ inputs.test_retry_count }}
-        
-    - name: build_stats
-      shell: bash
-      continue-on-error: true
-      if: always()
-      run: |
-        set -x
-        export build_preset="${{ inputs.build_preset }}" 
-        export commit_git_sha="$(git rev-parse HEAD)"
-
-        python3 -m pip install ydb ydb[yc]
-        python3 .github/scripts/send_build_stats.py
-
-    - name: show_build_size_diff
-      shell: bash
-      continue-on-error: true
-      if: always()
-      env:
-        GITHUB_TOKEN: ${{ github.token }}
-      run: |
-        set -x
-        export build_preset="${{ inputs.build_preset }}" 
-        export branch_to_compare="$GITHUB_REF_NAME" 
-        export yellow_treshold=102400
-        export red_treshold=2097152 
-        export commit_git_sha="$(git rev-parse HEAD)"
-
-        python3 -m pip install ydb ydb[yc] humanize
-
-        get_sizes_comment_script=.github/scripts/get_build_diff.py
-        comment_raw=`$get_sizes_comment_script`
-        
-        IFS=';;;'
-        read -ra comment_arr <<< "$comment_raw"
-
-        printf "$comment"
-        if [[ ${comment_raw} != "Error"* ]];then
-          color=${comment_arr[0]}
-          replace=$color";;;"
-          comment=${comment_raw/$replace/""}
-          
-          printf "$comment" | .github/scripts/tests/comment-pr.py --color $color
-
-        else
-          echo "Skipped build size difference, comment_raw = ${comment_raw}"
-        fi
-
-    - name: comment-if-cancel
-      shell: bash
-      if: cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
-      env:
-        BUILD_PRESET: ${{ inputs.build_preset }}
-        GITHUB_TOKEN: ${{ github.token }}
-      run:  echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black

+ 82 - 0
.github/actions/test_ya/action.yml

@@ -68,6 +68,34 @@ outputs:
 runs:
   using: "composite"
   steps:
+    - name: comment-build-start
+      if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
+      shell: bash
+      env:
+        BUILD_PRESET: ${{ inputs.build_preset }}
+        GITHUB_TOKEN: ${{ github.token }}
+      run: |
+        jobs_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs"
+        # tricky: we are searching job with name that contains build_preset
+        check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url')
+        
+        platform_name="$(echo "$(uname -s)-$(uname -p)" | tr '[:upper:]' '[:lower:]')-$BUILD_PRESET"
+        echo "Pre-commit [check]($check_url) **$platform_name** for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite
+
+        curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
+          https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
+          -d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'
+
+        if [[ "${{inputs.run_tests}}" == "true" ]];then
+          curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
+            https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
+            -d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
+        fi
+  
+    - name: Clean ya cache
+      shell: bash
+      run: rm -rf ~/.ya
+  
     - name: Init
       id: init
       shell: bash
@@ -519,3 +547,57 @@ runs:
       if: always()
       shell: bash
       run: df -h
+
+    - name: build_stats
+      shell: bash
+      continue-on-error: true
+      if: always()
+      run: |
+        set -x
+        export build_preset="${{ inputs.build_preset }}" 
+        export commit_git_sha="$(git rev-parse HEAD)"
+
+        python3 -m pip install ydb ydb[yc]
+        python3 .github/scripts/send_build_stats.py
+
+    - name: show_build_size_diff
+      shell: bash
+      continue-on-error: true
+      if: always()
+      env:
+        GITHUB_TOKEN: ${{ github.token }}
+      run: |
+        set -x
+        export build_preset="${{ inputs.build_preset }}" 
+        export branch_to_compare="$GITHUB_REF_NAME" 
+        export yellow_treshold=102400
+        export red_treshold=2097152 
+        export commit_git_sha="$(git rev-parse HEAD)"
+
+        python3 -m pip install ydb ydb[yc] humanize
+
+        get_sizes_comment_script=.github/scripts/get_build_diff.py
+        comment_raw=`$get_sizes_comment_script`
+        
+        IFS=';;;'
+        read -ra comment_arr <<< "$comment_raw"
+
+        printf "$comment"
+        if [[ ${comment_raw} != "Error"* ]];then
+          color=${comment_arr[0]}
+          replace=$color";;;"
+          comment=${comment_raw/$replace/""}
+          
+          printf "$comment" | .github/scripts/tests/comment-pr.py --color $color
+
+        else
+          echo "Skipped build size difference, comment_raw = ${comment_raw}"
+        fi
+
+    - name: comment-if-cancel
+      shell: bash
+      if: cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
+      env:
+        BUILD_PRESET: ${{ inputs.build_preset }}
+        GITHUB_TOKEN: ${{ github.token }}
+      run:  echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black