Skip to content

Commit

Permalink
Post graph_compare.sh logs (ydb-platform#8787)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximyurchuk authored Sep 6, 2024
1 parent a380bc7 commit e303177
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions .github/actions/test_ya/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,29 +115,37 @@ runs:
echo "NODE_TLS_REJECT_UNAUTHORIZED=0" >> $GITHUB_ENV
fi
- name: Generate ya.make with affected test suites and modules list
if: inputs.increment == 'true'
shell: bash
run: |
ORIGINAL_HEAD=$(git rev-parse HEAD)
./.github/scripts/graph_compare.sh $ORIGINAL_HEAD~1 $ORIGINAL_HEAD
git checkout $ORIGINAL_HEAD
- name: Change target in case of incremental
id: target_choice
shell: bash
run: |
if [ "${{ inputs.increment }}" == "true" ]; then
echo "target=." >> $GITHUB_OUTPUT
else
echo "target=${{ inputs.build_target }}" >> $GITHUB_OUTPUT
fi
- name: ya build and test
id: build
shell: bash
run: |
set -x
ORIGINAL_HEAD=$(git rev-parse HEAD)
if [ "${{ inputs.increment }}" = "true" ]; then
GRAPH_COMPARE_OUTPUT="$PUBLIC_DIR/graph_compare.log"
GRAPH_COMPARE_OUTPUT_URL="$PUBLIC_DIR_URL/graph_compare.log"
set +e
./.github/scripts/graph_compare.sh $ORIGINAL_HEAD~1 $ORIGINAL_HEAD |& tee $GRAPH_COMPARE_OUTPUT
RC=${PIPESTATUS[0]}
set -e
if [ $RC -ne 0 ]; then
echo "graph_compare.sh returned $RC, build failed"
echo "status=failed" >> $GITHUB_OUTPUT
BUILD_FAILED=1
echo "Graph compare failed, see the [logs]($GRAPH_COMPARE_OUTPUT_URL)." | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py --color red
exit $RC
fi
git checkout $ORIGINAL_HEAD
YA_MAKE_TARGET=.
else
YA_MAKE_TARGET=${{ inputs.build_target }}
fi
readarray -d ',' -t test_size < <(printf "%s" "${{ inputs.test_size }}")
readarray -d ',' -t test_type < <(printf "%s" "${{ inputs.test_type }}")
Expand Down Expand Up @@ -260,7 +268,6 @@ runs:
YA_MAKE_OUTPUT="$PUBLIC_DIR/ya_make_output.log"
YA_MAKE_OUTPUT_URL="$PUBLIC_DIR_URL/ya_make_output.log"
echo "20 [Ya make output]($YA_MAKE_OUTPUT_URL)" >> $SUMMARY_LINKS
echo "YA_MAKE_OUTPUT_URL=$YA_MAKE_OUTPUT_URL" >> $GITHUB_ENV

BUILD_FAILED=0

Expand Down Expand Up @@ -334,7 +341,7 @@ runs:

CURRENT_JUNIT_XML_PATH=$CURRENT_PUBLIC_DIR/junit.xml
set +ex
(./ya make ${{ steps.target_choice.outputs.target }} "${params[@]}" \
(./ya make $YA_MAKE_TARGET "${params[@]}" \
$RERUN_FAILED_OPT --log-file "$PUBLIC_DIR/ya_log.log" \
--evlog-file "$CURRENT_PUBLIC_DIR/ya_evlog.jsonl" \
--junit "$CURRENT_JUNIT_XML_PATH" --output "$YA_MAKE_OUT_DIR"; echo $? > exit_code) |& cat >> $YA_MAKE_OUTPUT
Expand All @@ -350,6 +357,7 @@ runs:
echo "ya make returned $RC, build failed"
echo "status=failed" >> $GITHUB_OUTPUT
BUILD_FAILED=1
echo "Build failed, see the [logs]($YA_MAKE_OUTPUT_URL)." | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py --color red
break
fi

Expand Down Expand Up @@ -433,8 +441,8 @@ runs:

if [ $BUILD_FAILED = 0 ]; then
echo "status=true" >> $GITHUB_OUTPUT
echo "Build successful." | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py --color green
fi


- name: comment-build-status
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
Expand All @@ -448,15 +456,12 @@ runs:
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":"failure","description":"The check has been failed","context":"build_${{inputs.build_preset}}"}'
echo "Build failed. see the [logs]($YA_MAKE_OUTPUT_URL)." | .github/scripts/tests/comment-pr.py --color red
else
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":"success","description":"The check has been completed successfully","context":"build_${{inputs.build_preset}}"}'
echo "Build successful." | .github/scripts/tests/comment-pr.py --color green
fi

- name: Clean up unfinished testmo sessions
if: always()
shell: bash
Expand Down

0 comments on commit e303177

Please sign in to comment.