@@ -2,23 +2,52 @@ name: Run benchmarks
2
2
3
3
on :
4
4
pull_request :
5
+ types : [opened, synchronize, reopened, labeled]
6
+
7
+ concurrency :
8
+ # Skip intermediate builds: always.
9
+ # Cancel intermediate builds: only if it is a pull request build.
10
+ group : ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress : ${{ startsWith(github.ref, 'refs/pull/') }}
5
12
6
13
jobs :
7
- Benchmark :
14
+ Benchmarking :
8
15
runs-on : ubuntu-latest
9
16
if : contains(github.event.pull_request.labels.*.name, 'performance critical')
10
- env :
11
- JULIA_DEBUG : BenchmarkCI
12
17
steps :
18
+ # setup
13
19
- uses : actions/checkout@v2
14
20
- uses : julia-actions/setup-julia@latest
15
21
with :
16
- version : 1.6
17
- - name : Install dependencies
18
- run : julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI"'
19
- - name : Run benchmarks
20
- run : julia -e "using BenchmarkCI; BenchmarkCI.judge()"
21
- - name : Post results
22
- run : julia -e "using BenchmarkCI; BenchmarkCI.postjudge()"
23
- env :
24
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22
+ version : ' 1.7'
23
+ - uses : julia-actions/julia-buildpkg@latest
24
+ - name : install dependencies
25
+ run :
julia -e 'using Pkg; pkg"add PkgBenchmark [email protected] "'
26
+ # run the benchmark suite
27
+ - name : run benchmarks
28
+ run : |
29
+ using BenchmarkCI
30
+ BenchmarkCI.judge()
31
+ BenchmarkCI.displayjudgement()
32
+ shell : julia --color=yes {0}
33
+ # generate and record the benchmark result as markdown
34
+ - name : generate benchmark result
35
+ run : |
36
+ using BenchmarkCI
37
+ judgement = BenchmarkCI._loadjudge(BenchmarkCI.DEFAULT_WORKSPACE)
38
+ title = "Kernel Benchmark Result"
39
+ ciresult = BenchmarkCI.CIResult(; judgement, title)
40
+ comment = sprint() do io
41
+ return BenchmarkCI.printcommentmd(io, ciresult)
42
+ end
43
+ comment = replace(comment, "%" => "%25", "\\n" => "%0A", "\\r" => "%0D")
44
+ write("benchmark-result.artifact", comment)
45
+ shell : julia --color=yes {0}
46
+ # record the pull request number
47
+ - name : record pull request number
48
+ run : echo ${{ github.event.pull_request.number }} > ./pull-request-number.artifact
49
+ # save as artifacts (performance tracking (comment) workflow will use it)
50
+ - uses : actions/upload-artifact@v2
51
+ with :
52
+ name : Benchmarking
53
+ path : ./*.artifact
0 commit comments