Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(benchmarks): fix benchmark post-processing #2004

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,13 @@ jobs:
if: failure()
with:
name: failed-benchmark-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}
path: |
./autotest/.failed/**
path: autotest/.failed/**

- name: Upload benchmark result artifact
uses: actions/upload-artifact@v3
with:
name: benchmarks-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}
path: |
./autotest/.benchmarks/**/*.json
path: autotest/.benchmarks/**/*.json

post_benchmark:
needs:
Expand Down Expand Up @@ -96,11 +94,17 @@ jobs:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ./autotest/.benchmarks
path: autotest/.benchmarks

- name: Process benchmark results
run: |
artifact_json=$(gh api -X GET -H "Accept: application/vnd.github+json" /repos/modflowpy/flopy/actions/artifacts)
repo="${{ github.repository }}"
path="autotest/.benchmarks"

# list benchmark artifacts
artifact_json=$(gh api -X GET -H "Accept: application/vnd.github+json" /repos/$repo/actions/artifacts)

# get artifact ids and download artifacts
get_artifact_ids="
import json
import sys
Expand All @@ -113,12 +117,16 @@ jobs:
"
echo $artifact_json \
| python -c "$get_artifact_ids" \
| xargs -I@ bash -c "gh api -H 'Accept: application/vnd.github+json' /repos/modflowpy/flopy/actions/artifacts/@/zip >> ./autotest/.benchmarks/@.zip"
zipfiles=( ./autotest/.benchmarks/*.zip )
| xargs -I@ bash -c "gh api -H 'Accept: application/vnd.github+json' /repos/$repo/actions/artifacts/@/zip >> $path/@.zip"

# unzip artifacts
zipfiles=( $path/*.zip )
if (( ${#zipfiles[@]} )); then
unzip -o './autotest/.benchmarks/*.zip' -d ./autotest/.benchmarks
unzip -o "$path/*.zip" -d $path
fi
python ./scripts/process_benchmarks.py ./autotest/.benchmarks ./autotest/.benchmarks

# process benchmarks
python scripts/process_benchmarks.py $path $path
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -127,5 +135,5 @@ jobs:
with:
name: benchmarks-${{ github.run_id }}
path: |
./autotest/.benchmarks/*.csv
./autotest/.benchmarks/*.png
autotest/.benchmarks/*.csv
autotest/.benchmarks/*.png