add basic CI Benchmarking

This commit is contained in:
Ian 2021-01-24 14:01:04 -05:00
parent 49eba0bf2f
commit 493ab0c6b4
2 changed files with 40 additions and 0 deletions

32
.github/workflows/benchmark.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Run benchmarks
on:
pull_request:
jobs:
Benchmark:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: 1
## Setup
- name: Default TESTCMD
run: echo "TESTCMD=julia" >> $GITHUB_ENV
- name: Ubuntu TESTCMD
if: startsWith(matrix.os,'ubuntu')
run: echo "TESTCMD=xvfb-run --auto-servernum julia" >> $GITHUB_ENV
- name: Install Plots dependencies
uses: julia-actions/julia-buildpkg@latest
- name: Install Benchmarking dependencies
run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"'
- name: Run benchmarks
run: $TESTCMD -e 'using BenchmarkCI; BenchmarkCI.judge()'
- name: Post results
run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

8
benchmark/benchmarks.jl Normal file
View File

@ -0,0 +1,8 @@
using BenchmarkTools
const SUITE = BenchmarkGroup()
# numbered to enforce sequence
SUITE["1_load"] = @benchmarkable @eval(using Plots)
SUITE["2_plot"] = @benchmarkable p = plot(1:0.1:10, sin.(1:0.1:10))
SUITE["3_display"] = @benchmarkable display(p) setup=(p = plot(1:0.1:10, sin.(1:0.1:10)))