Skip to content

Commit

Permalink
chore: comment bench results on PR
Browse files Browse the repository at this point in the history
Signed-off-by: Pranshu Srivastava <[email protected]>
  • Loading branch information
rexagod committed Dec 13, 2023
1 parent 8c1153e commit 714f40b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,28 @@ jobs:
run: |
make test-benchmark-compare
comment-ci-benchmark-tests:
name: comment-ci-benchmark-tests
runs-on: ubuntu-latest
needs: ci-benchmark-tests
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Comment benchmark results
uses: actions/github-script@v4
with:
github-token: ${{ secrets.KSM_BOT_TOKEN }}
script: |
const fs = require('fs');
const data = fs.readFileSync('benchstat.txt', 'utf8');
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: data
});
ci-build-kube-state-metrics:
name: ci-build-kube-state-metrics
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion tests/compare_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ echo ""
echo "### Result"
echo "old=${REF_TO_COMPARE} new=${REF_CURRENT}"

benchstat "${RESULT_TO_COMPARE}" "${RESULT_CURRENT}"
benchstat "${RESULT_TO_COMPARE}" "${RESULT_CURRENT}" > benchstat.txt
if [[ -z "${CI:-}" ]]; then
cat benchstat.txt
fi

0 comments on commit 714f40b

Please sign in to comment.