From 3b543a4aa4a48c4d709723fd9be218d41238b240 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Thu, 22 Aug 2024 10:12:25 +0200 Subject: [PATCH 1/2] chore(ci): disable unstable scap-related perf test from perf PR comment and check. Signed-off-by: Federico Di Pierro --- .github/workflows/perf.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index d52b861978..9f6ef9ddaa 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -60,11 +60,12 @@ jobs: head -n10 "perf_tests_diff.txt" >> ./pr/COMMENT echo "\`\`\`" >> ./pr/COMMENT echo "" >> ./pr/COMMENT - echo "# Perf diff from master - scap file" >> ./pr/COMMENT - echo "\`\`\`" >> ./pr/COMMENT - head -n10 "perf_scap_diff.txt" >> ./pr/COMMENT - echo "\`\`\`" >> ./pr/COMMENT - echo "" >> ./pr/COMMENT + # Drop unstable perf results! + # echo "# Perf diff from master - scap file" >> ./pr/COMMENT + # echo "\`\`\`" >> ./pr/COMMENT + # head -n10 "perf_scap_diff.txt" >> ./pr/COMMENT + # echo "\`\`\`" >> ./pr/COMMENT + # echo "" >> ./pr/COMMENT echo "# Heap diff from master - unit tests" >> ./pr/COMMENT echo "\`\`\`" >> ./pr/COMMENT tail -n3 "heaptrack_tests_diff.txt" >> ./pr/COMMENT @@ -98,13 +99,14 @@ jobs: # Check will fail if sum of all differences is >= 1%. # But we will always comment with the perf diff from master - - name: Check >= 1% threshold - perf scap file - if: always() # Even if other threshold checks failed - run: | - sum=$(awk '{sum+=sprintf("%f",$2)}END{printf "%.6f\n",sum}' perf_scap_diff.txt | tr ',' '.') - if (( $(echo "$sum >= 1.0" | bc -l) )); then - exit 1 - fi + # CHECK DISABLED: UNSTABLE PERF TEST. +# - name: Check >= 1% threshold - perf scap file +# if: always() # Even if other threshold checks failed +# run: | +# sum=$(awk '{sum+=sprintf("%f",$2)}END{printf "%.6f\n",sum}' perf_scap_diff.txt | tr ',' '.') +# if (( $(echo "$sum >= 1.0" | bc -l) )); then +# exit 1 +# fi # Check will fail if there is any heap memory usage difference >= 1M, # or if there is new memory leaked. From f1444843a23132d1df3ab22e26cacabc5724d41c Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Thu, 22 Aug 2024 10:37:49 +0200 Subject: [PATCH 2/2] chore(ci): update perf comment if already existing instead of always writing a new one. Signed-off-by: Federico Di Pierro --- .github/workflows/create-comment-perf.yml | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-comment-perf.yml b/.github/workflows/create-comment-perf.yml index 3f3dfe902c..03dd021e14 100644 --- a/.github/workflows/create-comment-perf.yml +++ b/.github/workflows/create-comment-perf.yml @@ -42,13 +42,34 @@ jobs: uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} + # Taken from https://github.com/actions/github-script/blob/main/.github/workflows/pull-request-test.yml script: | var fs = require('fs'); var issue_number = Number(fs.readFileSync('./NR')); var comment_body = fs.readFileSync('./COMMENT'); - await github.rest.issues.createComment({ + + // Get the existing comments. + const {data: comments} = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue_number, - body: comment_body.toString('utf8') }); + + // Find any comment already made by the bot. + const botComment = comments.find(comment => comment.user.id === 41898282 && comment.body.includes('# Perf diff from master')); + + if (botComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: comment_body.toString('utf8') + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: comment_body.toString('utf8') + }); + }