Skip to content

Commit

Permalink
Fix commit hash in benchmark pr
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzovarese committed Sep 12, 2024
1 parent 01b1188 commit f1c720f
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions .github/workflows/benchmark_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,44 +64,52 @@ jobs:
- name: Run Benchmarks
run: |
echo $PATH
echo "Current PATH: $PATH"
mkdir results
benchpkg --rev="${{ github.sha }},$(git rev-parse HEAD^1)" --bench-on="${{ github.sha }}" --output-dir=results/ --tune
- name: Generate and Upload Benchmark Plots
run: |
mkdir -p plots
git fetch origin main:refs/remotes/origin/main
LAST_MAIN_COMMIT=$(git rev-parse origin/main)
CURRENT_COMMIT=$(git rev-parse HEAD)
echo "Comparing CURRENT_COMMIT ($CURRENT_COMMIT) with LAST_MAIN_COMMIT ($LAST_MAIN_COMMIT)"
benchpkgplot --rev="$LAST_MAIN_COMMIT,$CURRENT_COMMIT" --npart=10 --format=png --input-dir=results/ --output-dir=plots/
if: always()
git fetch origin main:refs/remotes/origin/main
if [ $(git rev-list --count HEAD) -gt 1 ]; then
PREV_COMMIT=$(git rev-parse HEAD^1)
else
PREV_COMMIT=$(git rev-parse HEAD) # Fallback to the current commit if there's no previous commit
fi
CURRENT_COMMIT=$(git rev-parse HEAD)
LAST_MAIN_COMMIT=$(git rev-parse origin/main)
echo "Benchmarking current commit ($CURRENT_COMMIT) against $PREV_COMMIT"
benchpkg --rev="$LAST_MAIN_COMMIT,$CURRENT_COMMIT" --bench-on="$CURRENT_COMMIT" --output-dir=results/ --tune
- name: Generate and Upload Benchmark Plots
run: |
mkdir -p plots
LAST_MAIN_COMMIT=$(git rev-parse origin/main)
CURRENT_COMMIT=$(git rev-parse HEAD)
echo "Generating plots comparing CURRENT_COMMIT ($CURRENT_COMMIT) with LAST_MAIN_COMMIT ($LAST_MAIN_COMMIT)"
benchpkgplot --rev="$LAST_MAIN_COMMIT,$CURRENT_COMMIT" --npart=10 --format=png --input-dir=results/ --output-dir=plots/
if: always()

- name: Upload Plots as Artifacts
uses: actions/upload-artifact@v4
with:
name: benchmark-plots
path: plots

- name: Create and Display Benchmark Table
run: |
git fetch origin main:refs/remotes/origin/main # Ensures you have the latest main branch
mkdir -p results
if [ $(git rev-list --count HEAD) -gt 1 ]; then
PREV_COMMIT=$(git rev-parse HEAD^1)
else
PREV_COMMIT=$(git rev-parse HEAD) # Fallback to the current commit if there's no previous commit
PREV_COMMIT=$(git rev-parse HEAD) # Use the current commit as a fallback
fi
LAST_MAIN_COMMIT=$(git rev-parse origin/main) # Ensures comparison against the latest commit in main
echo "Using revisions: $LAST_MAIN_COMMIT and $PREV_COMMIT for benchmark comparison."
LAST_MAIN_COMMIT=$(git rev-parse origin/main) # Fetch the latest commit from main for comparison
echo "Creating benchmark table comparing CURRENT_COMMIT with LAST_MAIN_COMMIT"
benchpkgtable --rev="$LAST_MAIN_COMMIT,$PREV_COMMIT" --input-dir=results/ > table.md
echo '### Benchmark Results' > body.md
cat table.md >> body.md
echo '### Benchmark Plots' >> body.md
echo 'A plot of the benchmark results has been uploaded as an artifact to this workflow run.' >> body.md
cat body.md # Print the markdown table to the log for review.
if: always()

- name: Upload Benchmark Results Table
uses: actions/upload-artifact@v4
with:
Expand Down

0 comments on commit f1c720f

Please sign in to comment.