Bump version to v0.9.3 #2452
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip bm]')" | |
name: Benchmark | |
steps: | |
# Setup the main branch to run benchmarks there as a baseline for comparison | |
- name: Checkout to main | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true | |
- name: Main benchmark | |
id: main-benchmark | |
run: | | |
bin/benchmark | |
# Setup the PR's branch to run benchmarks and compare with main results | |
- name: Checkout to branch | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true | |
- name: Branch benchmark | |
id: benchmark | |
run: | | |
result=$(bin/benchmark) || true | |
echo "REPORT=$(echo "$result" | tr '\n' '#')" >> $GITHUB_OUTPUT | |
# Post the results as a comment on the PR | |
- name: Comment report | |
uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
const BODY_COMMENT = '```#${{ steps.benchmark.outputs.REPORT }}#```'.split("#").join("\n") | |
const { data: issueComments } = await github.rest.issues.listComments({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
}); | |
commentToUpdate = issueComments.find((comment) => | |
comment.body.includes("Benchmark results in seconds (slowest at top)") | |
); | |
if (commentToUpdate) { | |
await github.rest.issues.updateComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: commentToUpdate.id, | |
body: BODY_COMMENT, | |
}); | |
} else { | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: BODY_COMMENT, | |
}); | |
} |