Compare commits

..

1 Commits

Author SHA1 Message Date
dd785e83a3 Fixing timing test runner
All checks were successful
Merge-Checker / Benchmarking (pull_request) Successful in 22s
Merge-Checker / build_and_test (pull_request) Successful in 19s
2025-05-29 16:26:05 -04:00

View File

@@ -93,32 +93,35 @@ jobs:
echo "timings_changed=false" >> $GITHUB_OUTPUT
fi
- name: Leave PR comment with timing updates
if: steps.check_diff.outputs.timings_changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit and push timing results
if: steps.check_diff.outputs.timings_changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
run: |
echo "Preparing PR comment with new timing results..."
git config --global user.name "ci-bot"
git config --global user.email "ci-bot@local"
COMMENT_BODY=$(echo -e "### ⏱ Timing Results Changed\n\n" \
"The benchmark detected significant timing changes (≥ 0.1s).\n\n" \
"**Please review and commit the updated timing results** to:\n\`\`\`\nunit-tests/timing-results/matrix-timing-tests.txt\n\`\`\`\n\n" \
"Latest result:\n\`\`\`\n$(cat unit-tests/timing-results/matrix-timing-tests.txt)\n\`\`\`\n\n" \
"<!-- timing-bot-comment -->")
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
git stash
echo "Checking out source branch $BRANCH_NAME"
git fetch origin "$BRANCH_NAME"
git checkout "$BRANCH_NAME"
git pull
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "Checking if last commit was a timing update"
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
# Look for an existing bot comment
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${PR_NUMBER}/comments \
--jq '.[] | select(.body | contains("<!-- timing-bot-comment -->")) | .id')
if [ -z "$COMMENT_ID" ]; then
echo "Creating new PR comment"
gh api repos/${{ github.repository }}/issues/${PR_NUMBER}/comments \
-f body="$COMMENT_BODY"
if echo "$LAST_COMMIT_MSG" | grep -q "Update matrix-timing-tests timings"; then
echo "Last commit was a timing update, skipping commit."
exit 0
else
echo "Updating existing PR comment"
gh api repos/${{ github.repository }}/issues/comments/${COMMENT_ID} \
-X PATCH -F body="$COMMENT_BODY"
echo "Last commit name was: $LAST_COMMIT_MSG"
git stash pop
fi
git add unit-tests/timing-results/matrix-timing-tests.txt
if git diff --quiet --cached; then
echo "No changes to commit"
else
git commit -m "Update matrix-timing-tests timings"
git push origin "$BRANCH_NAME"
fi