forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Benchmarks | ||
|
||
on: | ||
issue_comment: | ||
|
||
jobs: | ||
benchmark: | ||
name: Run Benchmarks | ||
runs-on: ubuntu-latest | ||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/benchmark') | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJSON(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
- name: Checkout PR changes | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: refs/pull/${{ github.event.issue.number }}/head | ||
|
||
- name: Setup data and generate unique result names | ||
run: | | ||
cd benchmarks | ||
mkdir data | ||
# Setup the TPC-H data set with a scale factor of 10 | ||
./bench.sh data tpch | ||
# Generate a unique-ish identifiers for the results | ||
echo "HEAD_REF_SHA=pr-${{ github.event.issue.number }}" >> "$GITHUB_ENV" | ||
short_sha=$(echo "${{ github.sha }}" | cut -c1-7) | ||
echo "BASE_REF_SHA=main-$short_sha" >> "$GITHUB_ENV" | ||
- name: Benchmark PR changes | ||
env: | ||
RESULTS_NAME: ${{ env.HEAD_REF_SHA }} | ||
run: | | ||
cd benchmarks | ||
./bench.sh run tpch | ||
- name: Checkout base commit | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.sha }} | ||
clean: false | ||
|
||
- name: Benchmark baseline and generate comparison message | ||
env: | ||
RESULTS_NAME: ${{ env.BASE_REF_SHA }} | ||
run: | | ||
cd benchmarks | ||
./bench.sh run tpch | ||
echo ${{ github.event.issue.number }} > pr | ||
pip3 install rich | ||
cat > message.md <<EOF | ||
# Benchmark results | ||
<details> | ||
<summary>Benchmarks comparing ${{ github.sha }} and PR ${{ github.event.issue.number }}</summary> | ||
\`\`\` | ||
$(./bench.sh compare ${{ env.BASE_REF_SHA }} ${{ env.HEAD_REF_SHA }}) | ||
\`\`\` | ||
</details> | ||
EOF | ||
cat message.md | ||
- name: Upload benchmark comparison message | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: message | ||
path: benchmarks/message.md | ||
|
||
- name: Upload PR number | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pr | ||
path: benchmarks/pr |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: PR Comment | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Benchmarks"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
comment: | ||
name: PR Comment | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.conclusion == 'success' | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJSON(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
- name: Download comment message | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: message | ||
run-id: ${{ github.event.workflow_run.id }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Download pr number | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: pr | ||
run-id: ${{ github.event.workflow_run.id }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Print message and pr number | ||
run: | | ||
cat pr | ||
echo "PR_NUMBER=$(cat pr)" >> "$GITHUB_ENV" | ||
cat message.md | ||
- name: Post the comment | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const content = fs.readFileSync('message.md', 'utf8'); | ||
github.rest.issues.createComment({ | ||
issue_number: process.env.PR_NUMBER, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: content, | ||
}) |
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