Skip to content

Commit

Permalink
Push benchmark of every commit to tardis-benchmarks repository
Browse files Browse the repository at this point in the history
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
  • Loading branch information
officialasishkumar committed Jun 14, 2024
1 parent 74a46a2 commit cbefb9e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ jobs:

- name: Compare HEAD with master if PR
if: github.event_name == 'pull_request_target'
# continue-on-error: true # TODO: step failed sporadically while testing
continue-on-error: true # TODO: step failed sporadically while testing
run: |
asv continuous ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} | tee asv-cont-output.log
asv continuous master HEAD | tee asv-cont-output.log
if grep -q failed asv-cont-output.log; then
echo "Some benchmarks have errors!"
exit 1
fi
- name: Compare Master and PR head
run: asv compare ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} | tee asv-compare-output.log
run: asv compare master HEAD --config asv.conf.json | tee asv-compare-output.log

- name: Compare Master and PR head but only show changed results
run: asv compare ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} --only-changed | tee asv-compare-changed-output.log
run: asv compare master HEAD --only-changed --config asv.conf.json | tee asv-compare-changed-output.log

- name: Benchmarks compare output
id: asv_pr_vs_master
Expand All @@ -143,6 +143,40 @@ jobs:
with:
path: asv-compare-changed-output.log

- name: Run benchmarks for base to head commits of PR
if: github.event_name == 'pull_request_target'
run: |
mkdir -p PR-${{ github.event.number }}
cd PR-${{ github.event.number }}
asv run ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | tee asv-output-PR.log
if grep -q failed asv-output-PR.log; then
echo "Some benchmarks have failed!"
exit 1
fi
- name: Generate Graphs and HTML of PR
if: github.event_name == 'pull_request_target'
working-directory: PR-${{ github.event.number }}
run: asv publish

- name: Delete env files of PR
if: github.event_name == 'pull_request_target'
run: rm -r PR-${{ github.event.number }}/.asv/env

- name: Push results of PR to results repository
if: github.event_name == 'pull_request_target'
continue-on-error: true
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.BOT_TOKEN }}
with:
source-directory: PR-${{ github.event.number }}
destination-github-username: tardis-sn
destination-repository-name: tardis-benchmarks
user-email: tardis.sn.bot@gmail.com
target-branch: main
target-directory: PR

- name: Find Comment
if: always() && github.event_name == 'pull_request_target'
uses: peter-evans/find-comment@v1
Expand All @@ -165,6 +199,7 @@ jobs:
I ran benchmarks as you asked comparing master (${{ github.event.pull_request.base.sha }}) and the latest commit (${{ github.event.pull_request.head.sha }}).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts [**here**](${{ env.URL }}).
Significantly changed benchmarks:
<details>
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ benchmarks/data/*.h5
.asv/
pkgs/
release_hashes.txt

#PR directory (contains benchmarks)
PR-*
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Alexander Holas <alexander.holas@h-its.org> AlexHls <70367168+AlexHls@users.nore
Alexander Holas <alexander.holas@h-its.org> AlexHls <alexander.holas@h-its.org>
Alexander Holas <70367168+AlexHls@users.noreply.github.com>

Asish Kumar <officialasishkumar@gmail.com>

Alice Harpole <aliceharpole@gmail.com>
Alice Harpole <aliceharpole@gmail.com> Alice Harpole <harpolea@users.noreply.github.com>

Expand Down
2 changes: 1 addition & 1 deletion asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"python setup.py build",
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
],
"branches": ["master"],
"branches": ["master", "HEAD"],
"environment_type": "mamba",
"show_commit_url": "https://github.com/tardis-sn/tardis/commit/",
"conda_environment_file": "tardis_env3.yml",
Expand Down

0 comments on commit cbefb9e

Please sign in to comment.