Skip to content

Commit

Permalink
Use Mamba Instead of Conda When Running Benchmarks (#2455)
Browse files Browse the repository at this point in the history
* Use Mamba instead of conda

* Run asv for last 5 commits

* Add pull request trigger temporarily

* Reset

---------

Co-authored-by: atharva-2001 <aryaa_1@rknec.edu>
  • Loading branch information
atharva-2001 and atharva-2001 authored Dec 11, 2023
1 parent 4b51b68 commit b68e542
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- master

pull_request_target:
branches:
- '*'
- master

types:
- opened
- reopened
Expand Down Expand Up @@ -38,10 +40,10 @@ jobs:
- name: Checkout pull/${{ github.event.number }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.sha }}
fetch-depth: 0
if: github.event_name == 'pull_request_target'

- name: Restore Atom Data
uses: actions/cache/restore@v3
id: atom-data-restore
Expand All @@ -62,24 +64,34 @@ jobs:
with:
path: benchmarks/data/kurucz_cd23_chianti_H_He.h5
key: atom-data

- name: Setup Mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: benchmark
init-shell: >-
bash
create-args: >-
python
asv
mamba
- name: Install asv
run: pip install asv==0.5.*
run: pip install asv

- name: Accept all asv questions
run: asv machine --yes

- name: Run benchmarks for last 5 commits if not PR
if: github.event_name != 'pull_request_target'
continue-on-error: true
run: |
git log -n 5 --pretty=format:"%H" >> tag_commits.txt
asv run HASHFILE:tag_commits.txt | tee asv-output.log
if grep -q failed asv-output.log; then
echo "Some benchmarks have failed!"
exit 1
fi
- name: Generate Graphs and HTML
if: github.event_name != 'pull_request_target'
run: asv publish
Expand Down
2 changes: 1 addition & 1 deletion asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
],
"branches": ["master"],
"environment_type": "conda",
"environment_type": "mamba",
"show_commit_url": "https://github.com/tardis-sn/tardis/commit",
"conda_environment_file": "tardis_env3.yml",
"benchmark_dir": "benchmarks",
Expand Down

0 comments on commit b68e542

Please sign in to comment.