Skip to content

Commit f1c720f

Browse files
committed
Fix commit hash in benchmark pr
1 parent 01b1188 commit f1c720f

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

.github/workflows/benchmark_pr.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,44 +64,52 @@ jobs:
6464
6565
- name: Run Benchmarks
6666
run: |
67-
echo $PATH
67+
echo "Current PATH: $PATH"
6868
mkdir results
69-
benchpkg --rev="${{ github.sha }},$(git rev-parse HEAD^1)" --bench-on="${{ github.sha }}" --output-dir=results/ --tune
70-
71-
- name: Generate and Upload Benchmark Plots
72-
run: |
73-
mkdir -p plots
74-
git fetch origin main:refs/remotes/origin/main
75-
LAST_MAIN_COMMIT=$(git rev-parse origin/main)
76-
CURRENT_COMMIT=$(git rev-parse HEAD)
77-
echo "Comparing CURRENT_COMMIT ($CURRENT_COMMIT) with LAST_MAIN_COMMIT ($LAST_MAIN_COMMIT)"
78-
benchpkgplot --rev="$LAST_MAIN_COMMIT,$CURRENT_COMMIT" --npart=10 --format=png --input-dir=results/ --output-dir=plots/
79-
if: always()
80-
69+
git fetch origin main:refs/remotes/origin/main
70+
if [ $(git rev-list --count HEAD) -gt 1 ]; then
71+
PREV_COMMIT=$(git rev-parse HEAD^1)
72+
else
73+
PREV_COMMIT=$(git rev-parse HEAD) # Fallback to the current commit if there's no previous commit
74+
fi
75+
CURRENT_COMMIT=$(git rev-parse HEAD)
76+
LAST_MAIN_COMMIT=$(git rev-parse origin/main)
77+
echo "Benchmarking current commit ($CURRENT_COMMIT) against $PREV_COMMIT"
78+
benchpkg --rev="$LAST_MAIN_COMMIT,$CURRENT_COMMIT" --bench-on="$CURRENT_COMMIT" --output-dir=results/ --tune
79+
80+
- name: Generate and Upload Benchmark Plots
81+
run: |
82+
mkdir -p plots
83+
LAST_MAIN_COMMIT=$(git rev-parse origin/main)
84+
CURRENT_COMMIT=$(git rev-parse HEAD)
85+
echo "Generating plots comparing CURRENT_COMMIT ($CURRENT_COMMIT) with LAST_MAIN_COMMIT ($LAST_MAIN_COMMIT)"
86+
benchpkgplot --rev="$LAST_MAIN_COMMIT,$CURRENT_COMMIT" --npart=10 --format=png --input-dir=results/ --output-dir=plots/
87+
if: always()
88+
8189
- name: Upload Plots as Artifacts
8290
uses: actions/upload-artifact@v4
8391
with:
8492
name: benchmark-plots
8593
path: plots
86-
94+
8795
- name: Create and Display Benchmark Table
8896
run: |
89-
git fetch origin main:refs/remotes/origin/main # Ensures you have the latest main branch
97+
mkdir -p results
9098
if [ $(git rev-list --count HEAD) -gt 1 ]; then
9199
PREV_COMMIT=$(git rev-parse HEAD^1)
92100
else
93-
PREV_COMMIT=$(git rev-parse HEAD) # Fallback to the current commit if there's no previous commit
101+
PREV_COMMIT=$(git rev-parse HEAD) # Use the current commit as a fallback
94102
fi
95-
LAST_MAIN_COMMIT=$(git rev-parse origin/main) # Ensures comparison against the latest commit in main
96-
echo "Using revisions: $LAST_MAIN_COMMIT and $PREV_COMMIT for benchmark comparison."
103+
LAST_MAIN_COMMIT=$(git rev-parse origin/main) # Fetch the latest commit from main for comparison
104+
echo "Creating benchmark table comparing CURRENT_COMMIT with LAST_MAIN_COMMIT"
97105
benchpkgtable --rev="$LAST_MAIN_COMMIT,$PREV_COMMIT" --input-dir=results/ > table.md
98106
echo '### Benchmark Results' > body.md
99107
cat table.md >> body.md
100108
echo '### Benchmark Plots' >> body.md
101109
echo 'A plot of the benchmark results has been uploaded as an artifact to this workflow run.' >> body.md
102110
cat body.md # Print the markdown table to the log for review.
103111
if: always()
104-
112+
105113
- name: Upload Benchmark Results Table
106114
uses: actions/upload-artifact@v4
107115
with:

0 commit comments

Comments
 (0)