11name : Run benchmarks
2-
32on :
4- pull_request :
5- types : [labeled, opened, synchronize, reopened]
6-
7- # Only trigger the benchmark job when you add `run benchmark` label to the PR
3+ pull_request_target :
4+ types :
5+ - labeled
86jobs :
9- Benchmark :
10- runs-on : ubuntu-latest
11- if : contains(github.event.pull_request.labels.*.name, 'run benchmark')
7+ bmark :
8+ name : Julia ${{ matrix.version }} - macOS - ${{ matrix.arch }} - ${{ github.event_name }}
9+ if : contains(github.event.pull_request.labels.*.name, 'benchmarks')
10+ runs-on : [self-hosted, macOS]
11+ strategy :
12+ fail-fast : false
13+ matrix :
14+ version :
15+ - 1
16+ arch :
17+ - aarch64
1218 steps :
13- - uses : actions/checkout@v2
14- - uses : julia-actions/setup-julia@latest
19+ - uses : actions/checkout@v3
20+ - uses : julia-actions/setup-julia@v1
1521 with :
16- version : lts
17- - uses : julia-actions/julia-buildpkg@latest
18- - name : Install dependencies
19- run : julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI"'
22+ version : ${{ matrix.version }}
23+ arch : ${{ matrix.arch }}
24+ - uses : julia-actions/julia-buildpkg@v1
25+ - name : Installing non-registered dependencies
26+ run : |
27+ using Pkg
28+ pkg1 = PackageSpec(url = "https://github.com/JuliaSmoothOptimizers/JSOBenchmarks.jl.git", rev = "main")
29+ pkg_list = [pkg1]
30+ Pkg.add(pkg_list)
31+ shell : julia --project=benchmark --color=yes {0}
32+ - name : Install benchmark dependencies
33+ run : julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
34+ - name : Sanitize project name
35+ id : sanitize
36+ run :
37+ echo "REPONAME=${{ github.event.repository.name }}" | sed -e 's/\.jl$//' >> $GITHUB_OUTPUT
2038 - name : Run benchmarks
21- run : julia -e 'using BenchmarkCI; BenchmarkCI.judge(;baseline = "origin/main", script = joinpath(pwd(), "benchmark", "benchmarks.jl"))'
22- - name : Post results
23- run : julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
39+ run : julia --project=benchmark -e 'using JSOBenchmarks; run_benchmarks("${{ steps.sanitize.outputs.REPONAME }}", "benchmark", reference_branch = "bmark-workflow")'
2440 env :
41+ GITHUB_AUTH : ${{ secrets.GIST_TOKEN }}
42+ # - name: Post benchmark results in PR
43+ # uses: thollander/actions-comment-pull-request@v2
44+ # with:
45+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+ # message: "Full benchmark results stored as artifacts. Summary: ${{ secrets.BMARK_GIST_URL }}"
47+ - name : Build comment
48+ id : build-comment
49+ uses : actions/github-script@v6
50+ with :
51+ github-token : ${{ github.token }}
52+ result-encoding : string
53+ script : |
54+ const fs = require('fs');
55+ return fs.readFileSync("${{ github.workspace }}/${{ github.sha }}.md", "utf8").toString();
56+ - name : Comment in PR
57+ uses : thollander/actions-comment-pull-request@v2
58+ with :
2559 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60+ message : ${{ steps.build-comment.outputs.result }}
61+ - name : Upload benchmark plots
62+ 63+ with :
64+ path : ' ./*.png'
65+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
66+ title : ' Benchmarks at a Glance'
67+ annotationLevel : ' notice'
68+ - name : Upload artifacts
69+ uses : actions/upload-artifact@v2
70+ with :
71+ name : benchmarks
72+ path : |
73+ profiles_commit_vs_main_*.svg
74+ *_vs_main_*.jld2
75+ main.md
76+ ${{ github.sha }}.md
77+ judgement_${{ github.sha }}.md
0 commit comments