Process Benchmark Results V2 #328
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: 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@v1 | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Download all workflow run artifacts | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
path: artifacts | |
run_id: ${{github.event.workflow_run.id}} | |
- uses: actions/checkout@v3 | |
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@v2 | |
id: fc | |
if: github.event.workflow_run.event != 'push' | |
with: | |
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} | |
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@v2 | |
with: | |
sha: ${{ github.event.workflow_run.head_sha }} | |
body: ${{ steps.results.outputs.body }} | |
- name: Update comment | |
uses: peter-evans/create-or-update-comment@v3 | |
if: github.event.workflow_run.event != 'push' | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} | |
body: ${{ steps.results.outputs.body }} | |
edit-mode: replace | |
- name: Upload html | |
uses: actions/upload-artifact@v3 | |
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@v3 | |
if: github.event.workflow_run.event == 'push' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./gh-pages | |