59
59
- name : Install and Build Benchmarking Tools
60
60
run : |
61
61
julia -e 'using Pkg; Pkg.add("AirspeedVelocity"); Pkg.build("AirspeedVelocity")'
62
- echo "$HOME/.julia/bin" >> $GITHUB_ENV
62
+ echo "PATH=$PATH: $HOME/.julia/bin" >> $GITHUB_ENV
63
63
ls $HOME/.julia/bin
64
64
65
65
- name : Run Benchmarks
@@ -68,11 +68,15 @@ jobs:
68
68
mkdir results
69
69
benchpkg --rev="${{ github.sha }},$(git rev-parse HEAD^1)" --bench-on="${{ github.sha }}" --output-dir=results/ --tune
70
70
71
- - name : Generate and Upload Benchmark Plots
72
- run : |
73
- mkdir plots
74
- benchpkgplot --rev="${{ github.sha }},$(git rev-parse HEAD^1)" --npart=10 --format=png --input-dir=results/ --output-dir=plots/
75
- if : always()
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()
76
80
77
81
- name : Upload Plots as Artifacts
78
82
uses : actions/upload-artifact@v4
@@ -82,13 +86,21 @@ jobs:
82
86
83
87
- name : Create and Display Benchmark Table
84
88
run : |
85
- benchpkgtable --rev="${{ github.sha }},$(git rev-parse HEAD^1)" --input-dir=results/ > table.md
86
- cat table.md
89
+ git fetch origin main:refs/remotes/origin/main # Ensures you have the latest main branch
90
+ if [ $(git rev-list --count HEAD) -gt 1 ]; then
91
+ PREV_COMMIT=$(git rev-parse HEAD^1)
92
+ else
93
+ PREV_COMMIT=$(git rev-parse HEAD) # Fallback to the current commit if there's no previous commit
94
+ 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."
97
+ benchpkgtable --rev="$LAST_MAIN_COMMIT,$PREV_COMMIT" --input-dir=results/ > table.md
87
98
echo '### Benchmark Results' > body.md
88
99
cat table.md >> body.md
89
100
echo '### Benchmark Plots' >> body.md
90
101
echo 'A plot of the benchmark results has been uploaded as an artifact to this workflow run.' >> body.md
91
102
cat body.md # Print the markdown table to the log for review.
103
+ if : always()
92
104
93
105
- name : Upload Benchmark Results Table
94
106
uses : actions/upload-artifact@v4
0 commit comments