1
1
name : Benchmarking
2
2
3
3
on :
4
- push :
5
- branches :
6
- - master
4
+ pull_request :
7
5
8
6
jobs :
9
- benchmark :
7
+ benchmarks :
10
8
runs-on : ubuntu-latest
11
9
12
10
steps :
13
11
- name : Checkout Repository
14
12
uses : actions/checkout@v4
13
+ with :
14
+ ref : ${{ github.event.pull_request.head.sha }}
15
15
16
16
- name : Set up Julia
17
17
uses : julia-actions/setup-julia@v2
@@ -21,12 +21,46 @@ jobs:
21
21
- name : Install Dependencies
22
22
run : julia --project=benchmarks/ -e 'using Pkg; Pkg.instantiate()'
23
23
24
- - name : Run Benchmarks and Generate Reports
25
- run : julia --project=benchmarks/ -e 'using DynamicPPLBenchmarks; weave_benchmarks()'
24
+ - name : Run Benchmarks
25
+ id : run_benchmarks
26
+ run : |
27
+ # Capture version info into a variable, print it, and set it as an env var for later steps
28
+ version_info=$(julia -e 'using InteractiveUtils; versioninfo()')
29
+ echo "$version_info"
30
+ echo "VERSION_INFO<<EOF" >> $GITHUB_ENV
31
+ echo "$version_info" >> $GITHUB_ENV
32
+ echo "EOF" >> $GITHUB_ENV
33
+
34
+ # Capture benchmark output into a variable
35
+ echo "Running Benchmarks..."
36
+ benchmark_output=$(julia --project=benchmarks benchmarks/benchmarks.jl)
37
+
38
+ # Print benchmark results directly to the workflow log
39
+ echo "Benchmark Results:"
40
+ echo "$benchmark_output"
41
+
42
+ # Set the benchmark output as an env var for later steps
43
+ echo "BENCHMARK_OUTPUT<<EOF" >> $GITHUB_ENV
44
+ echo "$benchmark_output" >> $GITHUB_ENV
45
+ echo "EOF" >> $GITHUB_ENV
46
+
47
+ - name : Find Existing Comment
48
+ uses : peter-evans/find-comment@v3
49
+ id : find_comment
50
+ with :
51
+ issue-number : ${{ github.event.pull_request.number }}
52
+ comment-author : github-actions[bot]
26
53
27
- - name : Deploy to GitHub Pages
28
- uses : peaceiris/actions-gh-pages@v3
54
+ - name : Post Benchmark Results as PR Comment
55
+ uses : peter-evans/create-or-update-comment@v4
29
56
with :
30
- github_token : ${{ secrets.GITHUB_TOKEN }}
31
- publish_dir : ./benchmarks/results
32
- publish_branch : gh-pages
57
+ issue-number : ${{ github.event.pull_request.number }}
58
+ body : |
59
+ ## Computer Information
60
+ ```
61
+ ${{ env.VERSION_INFO }}
62
+ ```
63
+ ## Benchmark Report
64
+ ${{ env.BENCHMARK_OUTPUT }}
65
+ comment-id : ${{ steps.find_comment.outputs.comment-id }}
66
+ edit-mode : replace
0 commit comments