Skip to content

Process Benchmark Results V2 #1641

Process Benchmark Results V2

Process Benchmark Results V2 #1641

name: Process Benchmark Results V2
on:
workflow_run:
workflows:
- "CI v2"
types:
- completed
jobs:
process_benchmarks:
runs-on: ubuntu-latest
if: github.repository_owner == 'victimsnino' && github.event.workflow_run.conclusion == 'success'
steps:
- uses: haya14busa/action-workflow_run-status@main
- name: "Get PR information"
uses: potiuk/get-workflow-origin@v1_3
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Download all workflow run artifacts
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{secrets.GITHUB_TOKEN}}
path: artifacts
run_id: ${{github.event.workflow_run.id}}
- uses: actions/checkout@v4
with:
ref: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
path: gh-pages
- name: Process benchmarks
run: |
python3 ${{github.workspace}}/ci/process_benchmark_data.py ${{ github.event.workflow_run.head_sha }} "${{github.event.workflow_run.head_commit.message}}" > comment-body.txt
body="$(cat comment-body.txt)"
delimiter="$(openssl rand -hex 8)"
echo "body<<$delimiter" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT
id: results
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
if: github.event.workflow_run.event == 'pull_request'
with:
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
comment-author: 'github-actions[bot]'
body-includes: BENCHMARK RESULTS (AUTOGENERATED)
- name: Create comment
if: github.event.workflow_run.event == 'push'
uses: peter-evans/commit-comment@v3
with:
sha: ${{ github.event.workflow_run.head_sha }}
body: ${{ steps.results.outputs.body }}
- name: Update comment
uses: peter-evans/create-or-update-comment@v4
if: github.event.workflow_run.event == 'pull_request'
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
body: ${{ steps.results.outputs.body }}
edit-mode: replace
- name: Upload html
uses: actions/upload-artifact@v4
if: github.event.workflow_run.event == 'push'
with:
name: benchmark.html
path: ./gh-pages/v2/benchmark_results.json
- name: Deploy to github pages
uses: peaceiris/actions-gh-pages@v4
if: github.event.workflow_run.event == 'push'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages