Benchmarks report #53
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: Benchmarks report | |
on: | |
workflow_dispatch: | |
inputs: | |
job_id: | |
description: "Gitlab job id" | |
required: true | |
type: string | |
author: | |
description: "Commit author" | |
required: true | |
type: string | |
jobs: | |
bench_report: | |
name: Benchmark report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: "Collect Gitlab Benchmarks" | |
run: | | |
curl --location \ | |
--header "PRIVATE-TOKEN: ${{ secrets.GITLAB_CB_API_TOKEN }}" \ | |
--output benchmarks.json \ | |
"https://codebase.helmholtz.cloud/api/v4/projects/7930/jobs/${{ inputs.job_id }}/artifacts/heat/bench_data/benchmarks.json" | |
cat benchmarks.json | |
curl --location \ | |
--header "PRIVATE-TOKEN: ${{ secrets.GITLAB_CB_API_TOKEN }}" \ | |
--output report.txt \ | |
"https://codebase.helmholtz.cloud/api/v4/projects/7930/jobs/${{ inputs.job_id }}/artifacts/heat/bench_data/report.txt" | |
echo "Pipeline URL: https://codebase.helmholtz.cloud/helmholtz-analytics/cb/-/jobs/${{ inputs.job_id}}" >> $GITHUB_STEP_SUMMARY | |
cat report.txt >> $GITHUB_STEP_SUMMARY | |
- name: Compare and Save Benchmark Results | |
id: action_bench | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
# Benchmark action input and output | |
tool: "customSmallerIsBetter" | |
output-file-path: benchmarks.json | |
# Alert configuration | |
fail-on-alert: true # Don't fail on main branch | |
comment-on-alert: true | |
alert-comment-cc-users: ${{ format('@{0}', inputs.author) }} | |
# Save benchmarks from the main branch | |
save-data-file: ${{ github.ref == 'refs/heads/main' }} | |
# Pages configuration | |
auto-push: ${{ github.ref == 'refs/heads/main' }} | |
gh-pages-branch: gh-pages | |
benchmark-data-dir-path: dev/bench | |
- name: Update commit status | |
if: always() | |
run: | | |
if [[ "${{ steps.action_bench.outcome }}" =~ success|failure ]]; then export STEP_STATE="${{ steps.action_bench.outcome }}" && echo "then $STEP_STATE"; else export STEP_STATE=error && echo "else $STEP_STATE"; fi | |
echo "$STEP_STATE" | |
curl -L -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | |
-d "{ \"state\":\"$STEP_STATE\", \"target_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\", \"description\":\"The results are here!\", \"context\":\"cb/report\" }" |