1+ name : Benchmark
2+
3+ on :
4+ pull_request :
5+ types : [labeled, opened, synchronize, reopened]
6+
7+ permissions :
8+ pull-requests : write
9+
10+ jobs :
11+ Benchmark :
12+ runs-on : ubuntu-latest
13+ if : contains(github.event.pull_request.labels.*.name, 'benchmark')
14+ steps :
15+ - uses : actions/checkout@v4
16+ - uses : julia-actions/setup-julia@v2
17+ with :
18+ version : " 1"
19+ - uses : julia-actions/cache@v2
20+ - name : Extract Package Name from Project.toml
21+ id : extract-package-name
22+ run : |
23+ PACKAGE_NAME=$(grep "^name" Project.toml | sed 's/^name = "\(.*\)"$/\1/')
24+ echo "::set-output name=package_name::$PACKAGE_NAME"
25+ - name : Build AirspeedVelocity
26+ run : |
27+ # Lightweight build step, as sometimes the runner runs out of memory:
28+ julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.add("AirspeedVelocity")'
29+ julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.build("AirspeedVelocity")'
30+ - name : Add ~/.julia/bin to PATH
31+ run : |
32+ echo "$HOME/.julia/bin" >> $GITHUB_PATH
33+ - name : Run benchmarks
34+ run : |
35+ echo $PATH
36+ ls -l ~/.julia/bin
37+ mkdir results
38+ benchpkg ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --url=${{ github.event.repository.clone_url }} --bench-on="${{github.event.repository.default_branch}}" --output-dir=results/ --tune
39+ - name : Create markdown table from benchmarks
40+ run : |
41+ benchpkgtable ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --input-dir=results/ --ratio > table.md
42+ echo '### Benchmark Results' > body.md
43+ echo '' >> body.md
44+ echo '' >> body.md
45+ cat table.md >> body.md
46+ echo '' >> body.md
47+ echo '' >> body.md
48+ - name : Find Comment
49+ uses : peter-evans/find-comment@v3
50+ id : fcbenchmark
51+ with :
52+ issue-number : ${{ github.event.pull_request.number }}
53+ comment-author : ' github-actions[bot]'
54+ body-includes : Benchmark Results
55+ - name : Comment on PR
56+ uses : peter-evans/create-or-update-comment@v4
57+ with :
58+ comment-id : ${{ steps.fcbenchmark.outputs.comment-id }}
59+ issue-number : ${{ github.event.pull_request.number }}
60+ body-path : body.md
61+ edit-mode : replace
0 commit comments