-
Notifications
You must be signed in to change notification settings - Fork 48
63 lines (59 loc) · 2.22 KB
/
Benchmark-on-release.yml
File metadata and controls
63 lines (59 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Benchmark on release
on:
release:
types: [published]
jobs:
bench:
# Skip running on forks
if: ${{ !github.event.repository.fork }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- name: Instantiate benchmark env
run: julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
- name: Install benchmark deps
run: julia --project=benchmark -e 'using Pkg; pkg"add PkgBenchmark"'
- name: Run PkgBenchmark and save results
run: |
julia --project=benchmark -e '
using Dates, PkgBenchmark
# Run benchmarks; adjust the script path if yours differs
res = benchmarkpkg(pwd(); script="benchmark/benchmarks.jl")
# Save a machine-readable file
writeresults("benchmark-result.json", res)
# Also emit a lightweight Markdown summary
open("benchmark-result.md", "w") do io
println(io, "# Benchmark results for $(get(ENV, "GITHUB_REF_NAME", "unknown"))")
println(io, "")
println(io, "> Tag: $(get(ENV, "GITHUB_REF_NAME", "unknown"))")
println(io, "> Date: $(Dates.format(Dates.now(), "yyyy-mm-dd HH:MM")) UTC")
println(io, "")
show(io, "text/plain", res) # plain-text tree; renders fine in Markdown
println(io)
end
'
- name: Upload benchmark artifacts
uses: actions/upload-artifact@v4
with:
name: benchmark-${{ github.event.release.tag_name }}
path: |
benchmark-result.json
benchmark-result.md
- name: Upload assets to the GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
benchmark-result.json
benchmark-result.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}